bug-bash
[Top][All Lists]
Advanced

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

Re: temp env vs export


From: Chet Ramey
Subject: Re: temp env vs export
Date: Tue, 27 Jun 2023 15:49:58 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

On 6/22/23 1:54 PM, Grisha Levit wrote:
Using `export' / `readonly' on a variable that's present in both the temp
env and a calling function's local context combines the attributes of all
the intervening scopes in the global variable:

Hmmmm. Should it even get to this point? Temporary assignments preceding
function calls should go away, even in posix mode. The only thing that
could propagate in posix mode should be variable assignments directly
preceding `export',  but those should propagate back to the calling scope
and no further.

For instance, if you change the assignment to `v= export v', you get
the following output:

declare -A v

so certainly nothing propagated.

I realize it's not backwards-compatible, but propagating attributes from
export and readonly for variables that appear as assignments preceding
function calls looks like something that shouldn't be there in the first
place. What do you think?

Chet

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