[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: No expansions performed while declaring an associative array using a
From: |
Glenn Jackman |
Subject: |
Re: No expansions performed while declaring an associative array using a list of keys and values |
Date: |
Wed, 16 Dec 2020 10:58:57 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On 2020-12-15 16:58, Chet Ramey wrote:
> On 12/15/20 11:23 AM, Glenn Jackman wrote:
> > I would think that these pairs of invocations would correspond:
> >
> > declare -A v1=$( $foo 3 )
> > declare -A v1=$( [1]=2 [3]="")
> >
> > declare -A v1=$( "$foo" 3 )
> > declare -A v1=$( ['1 2']=3 )
> >
> > Do word splitting and quote removal not occur within the parentheses of an
> > _associative_ array definition?
>
> Associative array keys do not undergo word splitting on assignment, whether
> they are used in a subscript or the alternate key-value synatx. This has
> been the case since their introduction in bash-4.0.
Ah, that's the bit I was missing. Thank you for taking the time to
clarify. I don't see that documented in the manual though. Where did I
miss it?
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
Re: No expansions performed while declaring an associative array using a list of keys and values, felix, 2020/12/14