On 3/19/14, 5:42 PM, Geir Hauge wrote:
> > Description:
> > With an associative array, assoc, ${assoc[key]+set} expands to the
> > empty string if the associated value is the empty string.
>
> Thanks for the report. This was a consequence of a change made back in
> 2011 to expand the value portion of the assignment statement a slightly
> different way. I've attached a patch to fix it.
>
>
> Thanks. That patch also makes [[ -v assoc[x] ]] return 0. However,
> [[ -v assoc ]] returns 1 (which it also does before the patch). Sounds
> related to this bug.
That's not a bug. Referencing any array without a subscript is equivalent
to referencing subscript 0. In the case of an associative array, that's
${assoc["0"]}.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/