hush: fix a bug in argv restoration after sourcing a file
if sourced file "shift"ed argvs so that $1 is NULL, restore wasn't done. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
4
shell/ash_test/ash-misc/source_argv_and_shift.right
Normal file
4
shell/ash_test/ash-misc/source_argv_and_shift.right
Normal file
@ -0,0 +1,4 @@
|
||||
sourced_arg1:1
|
||||
arg1:
|
||||
sourced_arg1:a
|
||||
arg1:1
|
12
shell/ash_test/ash-misc/source_argv_and_shift.tests
Executable file
12
shell/ash_test/ash-misc/source_argv_and_shift.tests
Executable file
@ -0,0 +1,12 @@
|
||||
echo 'echo sourced_arg1:$1' >sourced1
|
||||
echo 'shift' >>sourced1
|
||||
|
||||
set -- 1
|
||||
. ./sourced1
|
||||
echo arg1:$1
|
||||
|
||||
set -- 1
|
||||
. ./sourced1 a
|
||||
echo arg1:$1
|
||||
|
||||
rm sourced1
|
Reference in New Issue
Block a user