Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -
DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -
DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -
DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2 -Wall
uname output: Linux CL3MMH29 2.6.32-26-generic #48-Ubuntu SMP Wed Nov 24 
09:00:03 UTC 2010 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release Status: release

Description:
I want to use the nounset option and I found that the option does not work 
with array-values in
         a arithmethic expression. See the following example:

jo...@cl3mmh29:~$ set -o nounset
jo...@cl3mmh29:~$ declare -ai ar
jo...@cl3mmh29:~$ ar[0]=1
jo...@cl3mmh29:~$ let y=ar[1]
jo...@cl3mmh29:~$ echo $y
0

The value of variable ar[1] is expanded to 0 although it was not set.
The full syntax produces the expected behavior:

jo...@cl3mmh29:~$ let z=${ar[1]}
bash: ar[1] ist nicht gesetzt.
                                                                                
                                               
Repeat-By:                                                                      
                                               
permanent


Fix:
The full syntax produces the expected behavior:

jo...@cl3mmh29:~$ let z=${ar[1]}
bash: ar[1] ist nicht gesetzt.

Reply via email to