Re: declare -ia does not enfore integer type on initialisation
From:
Chet Ramey
Subject:
Re: declare -ia does not enfore integer type on initialisation
Date:
Thu, 06 Feb 2014 09:02:47 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
On 2/5/14 5:25 PM, Peggy Russell wrote:
>>> Description:
>>> declare -ia not enforced if variable is initiated using =
>>
>> Correct; bash applies the integer attribute after the variable assignment.
>> It has been this way since arrays were introduced (well, at least as far
>> back as bash-3.2; that's when I stopped looking).
>
> Perhaps documenting the behavior would be helpful. Maybe the last sentence
> to the declare help could say, "Attributes added with -a or -A do not take
> effect until subsequent assignments."
Thanks, good idea.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/