ash: make "locak VAR" unset VAR (bash does that)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
438b4ac286
commit
109ee5d336
@ -8960,6 +8960,9 @@ mklocal(char *name)
|
||||
vp->flags |= VSTRFIXED|VTEXTFIXED;
|
||||
if (eq)
|
||||
setvareq(name, 0);
|
||||
else
|
||||
/* "local VAR" unsets VAR: */
|
||||
setvar(name, NULL, 0);
|
||||
}
|
||||
}
|
||||
lvp->vp = vp;
|
||||
|
4
shell/ash_test/ash-misc/local1.right
Normal file
4
shell/ash_test/ash-misc/local1.right
Normal file
@ -0,0 +1,4 @@
|
||||
A1:'A'
|
||||
A2:''
|
||||
A3:''
|
||||
A4:'A'
|
11
shell/ash_test/ash-misc/local1.tests
Executable file
11
shell/ash_test/ash-misc/local1.tests
Executable file
@ -0,0 +1,11 @@
|
||||
a=A
|
||||
f() {
|
||||
local a
|
||||
# the above line unsets $a
|
||||
echo "A2:'$a'"
|
||||
unset a
|
||||
echo "A3:'$a'"
|
||||
}
|
||||
echo "A1:'$a'"
|
||||
f
|
||||
echo "A4:'$a'"
|
Loading…
Reference in New Issue
Block a user