On 1/4/15 9:31 PM, Ivan Shapovalov wrote:
> If an empty array is declared using `declare -a NAME` and then immediately
> `declare -p NAME` is invoked, it says there is no such variable. 

A variable is not set until it is assigned a value.  `declare -p name' only
finds set variables.

> However, the array can be found in output of `declare -p` without NAME given.

Yes, since that is supposed to produce output that can recreate all
variables with their attributes, even unset variables.

This is a common enough request that I have changed the behavior of
`declare -p name' for the next bash release, and it will display variables
that are not set but have been given attributes.

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