bug-bash
[Top][All Lists]
Advanced

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

Re: should `local' create local variables when they exist in the tempenv


From: Chet Ramey
Subject: Re: should `local' create local variables when they exist in the tempenv?
Date: Thu, 13 Dec 2018 08:52:18 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 12/9/18 1:30 AM, Grisha Levit wrote:
> When a variable is present in the temporary environment and then declared
> local in a function, it seems to not actually make a local variable, in the
> sense that the variable does not show up in the output of `local',
> unsetting
> the variable reveals the variable from the higher scope rather than marking
> it invisible, etc.
> 
>     $ f() { local v=x; local -p; }; v=t f
> 
>     $ f() { local v; declare -p v; }; v=t f
>     declare -x v="t"
> 
>     $ f() { local v=x; unset v; declare -p v; }; v=g; v=t f
>     declare -- v="g"
> 
> Is this intentional?

It's a cosmetic issue. The variables behave the same even if they're not
flagged as local. I'll fix it for the next release.

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