Skip to content

Commit

Permalink
[spec/builtin-vars] Simple case to show 'local unset cell' semantics.
Browse files Browse the repository at this point in the history
Related to #706.
  • Loading branch information
Andy Chu committed Apr 17, 2020
1 parent 716b5dc commit a663c11
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/builtin-vars.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,28 @@ level2=yy
level2=
## END

#### unset of local reveals variable in higher scope

# Oil has a RARE behavior here (matching yash and mksh), but at least it's
# consistent.

x=global
f() {
local x=foo
echo x=$x
unset x
echo x=$x
}
f
## STDOUT:
x=foo
x=global
## END
## OK dash/bash/zsh/ash STDOUT:
x=foo
x=
## END

#### Unset invalid variable name
unset %
echo status=$?
Expand Down

0 comments on commit a663c11

Please sign in to comment.