bug-bash
[Top][All Lists]
Advanced

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

Re: ${!variable@operator} does not work for variables without values; i


From: Chet Ramey
Subject: Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a
Date: Fri, 21 Feb 2020 08:18:39 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

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    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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