Expanding an undefined array

2008-09-24 Thread Bernd Eggink
Is the following difference intentional, a bug, or do I miss something? unset a set -- "[EMAIL PROTECTED]" echo $# Output: 0 typeset a set -- "[EMAIL PROTECTED]" echo $# Output: 1 The man page says, "If the word is double-quoted, ... [EMAIL PROTECTED] expands each element of name

nullglob breaks unset of arrays

2008-09-24 Thread mario . trentini_bb
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='ba

Declaring a local variable circumvents "-e"

2008-09-24 Thread Björn Augustsson
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKA

Re: nullglob breaks unset of arrays

2008-09-24 Thread Chet Ramey
[EMAIL PROTECTED] wrote: > Bash Version: 3.2 > Patch Level: 39 > Release Status: release > > Description: > When nullglob option is enable (shopt -s nullglob), unset of an array > does not work. You're right; it does. `unset' is a builtin, so all of the shell's word expansions are p

Re: Declaring a local variable circumvents "-e"

2008-09-24 Thread Chet Ramey
Björn Augustsson wrote: > Bash Version: 3.2 > Patch Level: 33 > Release Status: release > > Description: > > The test case below is pretty self-explanatory. > The assignment in fun_bad() doesn't exit the shell, > despite the "set -e". > > This is the version in F

Re: Expanding an undefined array

2008-09-24 Thread Chet Ramey
Bernd Eggink wrote: > Is the following difference intentional, a bug, or do I miss something? > > unset a > set -- "[EMAIL PROTECTED]" > echo $# > > Output: 0 This is correct. > typeset a > set -- "[EMAIL PROTECTED]" > echo $# > > Output: 1 The question is how to treat the variabl

Re: Declaring a local variable circumvents "-e"

2008-09-24 Thread Bob Proulx
Chet Ramey wrote: > Björn Augustsson wrote: > > fun_bad() { local bah=$( false ); } > > fun_good() { local bah ; bah=$( false ); } > > The `local' command returns success if the variable assignment succeeds, > which it does. The command substitution doesn't affect its exit status. > This is how al