On 5/9/19 7:07 AM, Ulrich Windl wrote:
> Bash Version: 4.3
> Patch Level: 48
> Release Status: release
> 
> Hi!
> 
> Is this intended with "set -u":
> # set -u
> # declare -a INSTANCES
> # echo ${INSTANCES[*]}
> bash: INSTANCES[*]: unbound variable
> # INSTANCES=()
> # echo ${INSTANCES[*]}
> bash: INSTANCES[*]: unbound variable
> # echo ${INSTANCES[@]}
> bash: INSTANCES[@]: unbound variable

This was changed late in the bash-4.4 development cycle (July, 2016). From
bash-4.4/CHANGES:

a.  Using ${a[@]} or ${a[*]} with an array without any assigned elements when
    the nounset option is enabled no longer throws an unbound variable error.

Chet

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

Reply via email to