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?