Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Chet Ramey
> > For me, an empty string (or empty commadline) is as set or as > > unset as an empty array. But I don't get an "unbound error" when > > accessing an empty string (or empty commandline), and I get one > > when accessing an empty array. > > As the man page says: > > A parameter is set if it has

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Chet Ramey
On 12/20/10 3:52 AM, jens.schmid...@arcor.de wrote: >> -u Treat unset variables as an error when substituting. >> >> I think the behaviour is consistent with the documentation. > > The question is rather when to consider a variable set or unset. > > For me, an empty string (or empty commadline)

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Jan Schampera
jens.schmid...@arcor.de wrote: -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. The question is rather when to consider a variable set or unset. I'm not sure about the intended meaning here, but I don't consiter $@ as a var

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread jens . schmidt35
> -u Treat unset variables as an error when substituting. > > I think the behaviour is consistent with the documentation. The question is rather when to consider a variable set or unset. For me, an empty string (or empty commadline) is as set or as unset as an empty array. But I don't get an "

Re: Referencing empty array with "set -u" active throws error

2010-12-18 Thread Chet Ramey
On 12/17/10 4:48 AM, jens.schmid...@arcor.de wrote: > Bash Version: 4.1 > Patch Level: 0 > Release Status: release > > Description: >Referencing empty array with "set -u" active throws unbound variable error. > > Repeat-By: > $ set -u > $ declare -a array > $ array=( ) > $ echo "${ar

Re: Referencing empty array with "set -u" active throws error

2010-12-18 Thread Jan Schampera
jens.schmid...@arcor.de wrote: For an empty "$@" this does not throw an "unbound" error, which seems to be an inconsistent behaviour to me. -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. -- Be conservative in what you d

Referencing empty array with "set -u" active throws error

2010-12-17 Thread jens . schmidt35
Configuration Information [Automatically generated, do not change]: Machine: sparc OS: solaris2.9 Compiler: /sapmnt/global/tools/compiler/SS11/SUNWspro/bin/cc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' -DCONF_OSTYPE='solaris2.9' -DCONF_MACHTYPE='sparc-sun-solaris2.9' -DCONF_VEN