bug-bash
[Top][All Lists]
Advanced

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

Re: question on retrieving map(-A) value w/indirect name


From: David Margerison
Subject: Re: question on retrieving map(-A) value w/indirect name
Date: Sat, 17 Mar 2018 13:25:58 +1100

On 17 March 2018 at 11:50, L A Walsh <bash@tlinx.org> 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.

I think this does what you want ...

$ declare -A foo=([one]=11 [two]=22)
$ fee=foo[one]
$ echo "${!fee}"
11



reply via email to

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