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:
Denys Vlasenko
2017-01-09 08:13:21 +01:00
parent 4e4f88e569
commit 2b1559056c
5 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,4 @@
sourced_arg1:1
arg1:
sourced_arg1:a
arg1:1

View 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