bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing the way bash expands associative array subscripts


From: Chet Ramey
Subject: Re: Changing the way bash expands associative array subscripts
Date: Tue, 13 Apr 2021 21:32:25 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0

On 4/13/21 6:36 PM, L A Walsh wrote:

----
   So echo ${a[@]} = expansion of all, but
unset a[@] would only delete 1 element w/key '@'....
how do I echo 1 element with key '@'

Creating arbitrary definitions of behavior for the similar syntax
seems like a sign of random feature-ism.

The behavior of the `@' and `*' subscripts meaning all elements of the
array long predates associative arrays.

This is one reason for the ability to quote subscripts to defer evaluation.


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]