On 2007-09-11, Enrico Scholz wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i686 > OS: linux-gnu > Compiler: gcc > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-redhat-linux-gnu' > -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' > -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic > -fasynchronous-unwind-tables > uname output: Linux kosh.bigo.ensc.de 2.6.22.3-ensc-1 #1 SMP PREEMPT Thu Aug > 16 23:36:51 CEST 2007 i686 i686 i386 GNU/Linux > Machine Type: i686-redhat-linux-gnu > > Bash Version: 3.2 > Patch Level: 9 > Release Status: release > > Description: > > A syntactical wrong statement will confuse bash permanently so that > arithmetic operations return wrong results. > > > Repeat-By: > [copy from https://bugzilla.redhat.com/show_bug.cgi?id=286861] > $ i=0 > $ let ++i > $ echo $i > 1 > > $ let tmp="foo.a"+0 > bash: let: tmp=foo.a+0: syntax error: invalid arithmetic... > > $ i=0 > $ let ++i > $ echo $i > 0 > > --> every further use of 'let' will generate bogus results. bash-3.1 returns > expected results.
I agree that it is a bug, but it is one that will never bother me because I always use the POSIX arithmetic syntax: i=$(( $i + 1 )) What's the point of using let? -- Chris F.A. Johnson <http://cfaj.freeshell.org> =================================================================== Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) .