shopt-option
localvar_unset
An inner unset of an outer local marks it unset until the outer function returns. Test exact visibility rather than relying on implicit dynamic scope.
Formal Syntax & Structure
bash syntaxbash
shopt -s localvar_unsetReturn Value
exit status
An inner unset of an outer local marks it unset until the outer function returns. Test exact visibility rather than relying on implicit dynamic scope.
Working Example
Example Snippetbash
value=globalinner() { unset value; }outer() { local value=local; inner; printf 'outer=%s\n' "${value-unset}"; }shopt -s localvar_unsetouterprintf 'global=%s\n' "$value"