On Fri, Mar 16, 2018 at 05:50:04PM -0700, L A Walsh wrote:
> 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.
1
David Margerison wrote:
processSrvState() {
local cur_up="$1[cur_up]"
local max_up="$1[max_up]"
if [[ "${!cur_up}" == "${!max_up}" ]] ; then
echo ok
fi
}
declare -A foo=([cur_up]=11 [max_up]=11)
processSrvState foo
# note that the array name must not conflict with any keys
Th
On 17 March 2018 at 20:40, L A Walsh wrote:
>
> I seebut that begs the question, how do you access an array's
> members using a var holding the array's name?
>
> I wanted to be able to do something like have a set of
> values in an assoc. map, and pass the name to a generic
> processing routin
On 17 March 2018 at 11:50, 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 synta
Chet Ramey wrote:
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.
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 syntax
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.
If I ignore the indirect char '!', and do it the
old way but