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: Fri, 9 Apr 2021 10:53:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0

On 4/8/21 6:23 PM, Koichi Murase wrote:

I currently don't have any better idea, but in that way, it seems to
me that there is no way to represent a reference to an element
associated with key=@ under the new `assoc_expand_once', which was
what I wanted to argue in my previous reply.

Under what circumstances? In shell builtins? Something else? Certainly
the following will work:

declare -A assoc
key=@

assoc[$key]=at
assoc[!]=bang

echo ${assoc[$key]}

and print `at'.

--
``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]