On 11/27/12 5:03 AM, Tim Friske wrote:
> Hi folks,
> 
> when I execute the following code in Bash version "GNU bash, version
> 4.1.10(4)-release (i686-pc-cygwin)", I get:
> 
> declare a
> declare -p a
> # Output: -bash: declare: a: not found
> declare -i b
> declare -p b
> # Output: -bash: declare: b: not found
> declare -a c
> declare -p c
> # Output: declare -a c='()'
> declare -A d
> declare -p d
> # Output: declare -A d='()'
> 
> Arguably I think that the above variables should either be initialized
> in all cases or in none of them. That would seem more consistent
> rather than initializing only arrays upon declaration.

Thanks for the report.  This is an artifact of how the arrays/hash tables
are initialized by `declare', as you suspect.  The variable should remain
undefined until explicitly assigned a value.  I will take a look and see
what effect that will have on other parts of the code.

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