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


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

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

Started byGrisha Levit <grishalevit@gmail.com>
First post2018-12-09 01:30 -0500
Last post2018-12-09 01:30 -0500
Articles 1 — 1 participant

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


Contents

  should `local' create local variables when they exist in the tempenv? Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:30 -0500

#14900 — should `local' create local variables when they exist in the tempenv?

FromGrisha Levit <grishalevit@gmail.com>
Date2018-12-09 01:30 -0500
Subjectshould `local' create local variables when they exist in the tempenv?
Message-ID<mailman.5422.1544337070.1284.bug-bash@gnu.org>
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?

[toc] | [standalone]


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


csiph-web