Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14912
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: should `local' create local variables when they exist in the tempenv? |
| Date | 2018-12-13 08:52 -0500 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.5673.1544709151.1284.bug-bash@gnu.org> (permalink) |
| References | <CAMu=Brq68iEs5AEXJd+aBdM77qtZzZK1KKk7dtkDu0QA=K7beA@mail.gmail.com> |
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/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: should `local' create local variables when they exist in the tempenv? Chet Ramey <chet.ramey@case.edu> - 2018-12-13 08:52 -0500
csiph-web