Re: Funny behaviour of associative arrays

2023-06-27 Thread Robert Elz
Date:Tue, 27 Jun 2023 07:44:56 -0400 From:Greg Wooledge Message-ID: | I'm seeing some parser voodoo here. Not doing field splitting, or globbing, is normal for any assignment statement. Consider the simple (no arrays involved) IFS=$', \t\n' var=x*,y? final=$var

Re: Funny behaviour of associative arrays

2023-06-27 Thread Greg Wooledge
On Tue, Jun 27, 2023 at 06:24:30AM -0500, Dennis Williamson wrote: > Your first assignment is a way to assign a list of members to an > associative array. Your second assignment creates a single element with the > index "[a]=b [c]=d" which has a null value. I'm seeing some parser voodoo here. uni

Re: Funny behaviour of associative arrays

2023-06-27 Thread Robert Elz
Date:Tue, 27 Jun 2023 07:29:42 +0200 From:n952162 Message-ID: I suspect this message really should have gone to the bash-help list. Never mind: | If so, why? I think this is related to the message I sent to the list early this morning (my time) -- bash is decidin

Re: Funny behaviour of associative arrays

2023-06-27 Thread Dennis Williamson
On Tue, Jun 27, 2023 at 12:29 AM n952162 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

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 07:29 n952162 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 > ar

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 11:00 alex xmb ratchev wrote: > > > On Tue, Jun 27, 2023, 07:29 n952162 wrote: > >> Is this correct? >> >> declare -A l1 >> >> l1=([a]=b [c]=d) >> echo ${!l1[@]} >> >> l1=($(echo [a]=b [c]=d)) >> echo ${!l1[@]} >> > > declare -A "l1=( $( echo [ab]=22 ) )

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 07:29 n952162 wrote: > Is this correct? > > declare -A l1 > > l1=([a]=b [c]=d) > echo ${!l1[@]} > > l1=($(echo [a]=b [c]=d)) > echo ${!l1[@]} > declare -A "l1=( $( echo [ab]=22 ) )" declare -A "l1+=( name content )" l1+=( third 33 ) declare -p l1 ---

Funny behaviour of associative arrays

2023-06-26 Thread n952162
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?