bug-bash
[Top][All Lists]
Advanced

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

Re: Funny behaviour of associative arrays


From: alex xmb ratchev
Subject: Re: Funny behaviour of associative arrays
Date: Tue, 27 Jun 2023 11:26:41 +0200

On Tue, Jun 27, 2023, 07:29 n952162 <n952162@web.de> wrote:

> Is this correct?
>
>     declare -A l1
>
>     l1=([a]=b [c]=d)
>     echo ${!l1[@]}
>
>     l1=($(echo [a]=b [c]=d))
>     echo ${!l1[@]}
>
> $ bash  t4
> c a
> [a]=b [c]=d
>
> If so, why?  And how can I assign a list of members to an associative
> array?
>

also a way to assign is

declare -A a
a[sometext]=some.. a[some other]=22 var=third' 'is a[$var]=33
declare -p a
-------------------
declare -A a=(["some other"]="22" [sometext]="some.." ["third is"]="33" )


reply via email to

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