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 "${arr...@]}"
>   bash: arr...@]: unbound variable

A variable isn't set until it's been assigned a value.

>   For an empty "$@" this does not throw an "unbound" error, which seems to be 
> an inconsistent behaviour to me.

Bash used to do this, but Posix declared that $@ and $* are exceptions
to the unset variable rule.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to