Re: [patch] bashism in sh script
On Fri, 1 Aug 2003, GoTaR wrote: There's no thing like $[..] to evaluate expressions in POSIX sh, it's bash feature. sh uses $((..)) instead (and bash understands it too). Here comes fix. Does the next line work for you? I mean this: if (( $A 10 )); then A=0$A; fi I think it's a much worse case of non-portable code. Have you tested your changes? -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [patch] bashism in sh script
On Fri, 8 Aug 2003, Andrew V. Samoilov wrote: I think patch below make audio.in much more portable. Applied. BTW, I don't see reason to substitute audio from audio.in. There is @AWK@ in audiofs_copyout(), but it's hard to notice :-) -- Regards, Pavel Roskin ___ Mc-devel mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [patch] bashism in sh script
On Fri, 1 Aug 2003, GoTaR wrote: There's no thing like $[..] to evaluate expressions in POSIX sh, it's bash feature. sh uses $((..)) instead (and bash understands it too). Here comes fix. Does the next line work for you? I mean this: if (( $A 10 )); then A=0$A; fi I think it's a much worse case of non-portable code. Have you tested your changes? I think patch below make audio.in much more portable. BTW, I don't see reason to substitute audio from audio.in. -- Regards, Andrew V. Samoilov. --- audio.in~ Fri Dec 13 06:42:10 2002 +++ audio.inFri Aug 8 10:54:31 2003 @@ -15,13 +15,12 @@ audiofs_list () { echo -r--r--r-- 1 0 0 0 Jan 1 0:00 CDDB -cdparanoia -Q -d $1 21 | grep '^[ 0-9][ 0-9][ 0-9]\.' | while true +cdparanoia -Q -d $1 21 | grep '^[ 0-9][ 0-9][ 0-9]\.' | while read A B C do -read A B C || break -A=`echo $A | sed 's/\.//'` -SIZE=$[44+$B*2352] -if (( $A 10 )); then A=0$A; fi -echo -r--r--r-- 1 0 0 $SIZE Jan 1 0:00 track-${A}.wav + A=`echo $A | sed 's/\.//'` + SIZE=`expr 44 + $B \* 2352` + if test $A -lt 10 ; then A=0$A; fi + echo -r--r--r-- 1 0 0 $SIZE Jan 1 0:00 track-${A}.wav done } @@ -41,7 +40,7 @@ } if [ ! -b $2 ] -then +then BASE=/dev/cdrom else BASE=$2
[patch] bashism in sh script
Hi! There's no thing like $[..] to evaluate expressions in POSIX sh, it's bash feature. sh uses $((..)) instead (and bash understands it too). Here comes fix. -- Tom Pala [EMAIL PROTECTED] diff -urN mc/vfs/extfs/audio.in mc.new/vfs/extfs/audio.in --- mc/vfs/extfs/audio.in 2002-12-13 05:42:10.0 +0100 +++ mc.new/vfs/extfs/audio.in 2003-08-01 10:41:06.0 +0200 @@ -19,7 +19,7 @@ do read A B C || break A=`echo $A | sed 's/\.//'` -SIZE=$[44+$B*2352] +SIZE=$((44+$B*2352)) if (( $A 10 )); then A=0$A; fi echo -r--r--r-- 1 0 0 $SIZE Jan 1 0:00 track-${A}.wav done