bug-bash
[Top][All Lists]
Advanced

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

Re: ${var@A} expands to empty string for unset, but declared variables w


From: Chet Ramey
Subject: Re: ${var@A} expands to empty string for unset, but declared variables with no attributes
Date: Thu, 7 Apr 2022 11:00:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 4/6/22 9:50 PM, Emanuele Torre wrote:

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
        `${var@A}' only expands to something if either var is set or is
        declared with attributes; it doesn't expand to `declare -- var'
        for variables that are declared but don't have any attribute and
        are unset.

That could apply to an infinite number of variables. There is no effective
difference between `declare hello' and no declaration at all: both are
unset and have no attributes that could make a difference when you want
to assign a value.

It's marginally useful to display the attributes of an unset variable if
you're interested in duplicating it at some later point. There's no point
to doing that if the variable has no attributes.


--
``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/



reply via email to

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