Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15946

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a
Date 2020-02-21 08:18 -0500
Message-ID <mailman.1358.1582291127.2412.bug-bash@gnu.org> (permalink)
References <CALaCa4xQYy3pT31++yU-QcXvQg-EJctg8etQX5e+c4fcw=pEhA@mail.gmail.com> <CALaCa4yT7bhctg+ShwYXYaB6XeoKNr_GwokSCtrB_8NPiJfQwg@mail.gmail.com> <4d823048-6e6a-b697-e1e8-8273b1ecd1ee@case.edu> <CALaCa4y7JSh+MoEqQxe7+fj9BpxrKjkL6uR-66aoMrGSHyWWOQ@mail.gmail.com> <c79ec1a4-eb39-1cce-07a1-0814aa9f7df6@case.edu>

Show all headers | View raw


On 2/20/20 6:23 PM, Arfrever Frehtes Taifersar Arahesis wrote:


> Even more strangely, quoting apparently matters...

Yes, this is a bug:

> $ echo "${VAR1[@]@A}"
> declare -rl VAR1=''

>> The question is whether the unset variables should display commands to
>> set the attributes (@A) or display any attributes (@a).
> 
> I think that it would be expected that @A prints the same as 'declare
> -p' for given variable.

That's not unreasonable, but it takes some consideration. You have to be
careful separating out these cases from the usual case, where a variable
name in a brace expansion is expanded to nothing if it's unset.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: ${!variable@operator} does not work for variables without values;  inconsistencies between present and absent [@] for @A and @a Chet Ramey <chet.ramey@case.edu> - 2020-02-21 08:18 -0500

csiph-web