On 3/16/18 8:50 PM, L A Walsh wrote:
> 
> I'm a bit confused ...
> If I have assoc-array:
> 
>  declare -A foo=([one]=11 [two]=22)
> 
> and am passing name in another var, like "fee"
> 
>  fee=foo
> 
> I tried echoing the val:
> 
>  echo ${!fee[one]}
> 
> but got nothing -- tried a few other syntaxes.

This has come up a number of times. Here's a message from 2002 explaining
the details:

https://lists.gnu.org/archive/html/bug-bash/2002-08/msg00119.html


> Question -- why did '!' replace the 2nd $ if it doesn't
> work in arrays?

It does, but differently from how you expect.

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

Reply via email to