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


Groups > gnu.bash.bug > #14900

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

From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject should `local' create local variables when they exist in the tempenv?
Date 2018-12-09 01:30 -0500
Message-ID <mailman.5422.1544337070.1284.bug-bash@gnu.org> (permalink)

Show all headers | View raw


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?

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web