help-bash
[Top][All Lists]
Advanced

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

Re: Changing the way bash expands associative array subscripts


From: Eli Schwartz
Subject: Re: Changing the way bash expands associative array subscripts
Date: Tue, 6 Apr 2021 14:18:46 -0400

On 4/6/21 1:42 PM, Greg Wooledge wrote:
> That said, the fact that you can put 'a[@]' in an indirect variable and
> get an array expansion out of "${!x}" is completely repulsive to me.  In
> the past, I have asked whether this is actually working as intended,
> and Chet's answer simply confused me, but near as I can tell, he seems
> to think it should continue doing this.  So I won't say anything more
> about it.


It bothers me too, but x=a; echo "${!x[@]}" gets you something else
entirely...

Reading the manpage with "it does do this" in mind, it seems to make
sense, because under Parameter Expansion it defines

    ${parameter}
        The value of parameter is substituted. [...] The parameter is a
        shell parameter as described above PARAMETERS) or an array
        reference (Arrays).

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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