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


Groups > gnu.bash.bug > #14912 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2018-12-13 08:52 -0500
Last post2018-12-13 08:52 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: should `local' create local variables when they exist in the tempenv? Chet Ramey <chet.ramey@case.edu> - 2018-12-13 08:52 -0500

#14912 — Re: should `local' create local variables when they exist in the tempenv?

FromChet Ramey <chet.ramey@case.edu>
Date2018-12-13 08:52 -0500
SubjectRe: should `local' create local variables when they exist in the tempenv?
Message-ID<mailman.5673.1544709151.1284.bug-bash@gnu.org>
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    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web