hush: add support for local builtin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
3
shell/hush_test/hush-misc/func_local1.right
Normal file
3
shell/hush_test/hush-misc/func_local1.right
Normal file
@ -0,0 +1,3 @@
|
||||
z=a
|
||||
z=z
|
||||
Done
|
5
shell/hush_test/hush-misc/func_local1.tests
Executable file
5
shell/hush_test/hush-misc/func_local1.tests
Executable file
@ -0,0 +1,5 @@
|
||||
export z=z
|
||||
f() { local z=a; env | grep ^z; }
|
||||
f
|
||||
env | grep ^z
|
||||
echo Done
|
14
shell/hush_test/hush-misc/func_local2.right
Normal file
14
shell/hush_test/hush-misc/func_local2.right
Normal file
@ -0,0 +1,14 @@
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
2
|
||||
2
|
||||
3
|
||||
1
|
||||
Done
|
7
shell/hush_test/hush-misc/func_local2.tests
Executable file
7
shell/hush_test/hush-misc/func_local2.tests
Executable file
@ -0,0 +1,7 @@
|
||||
x=1
|
||||
f() { echo $x; local x=$((x+1)); echo $x; }
|
||||
g() { f; echo $x; f; local x=$((x+1)); f; echo $x; f; }
|
||||
f
|
||||
g
|
||||
echo $x
|
||||
echo Done
|
Reference in New Issue
Block a user