Project

General

Profile

« Previous | Next » 

Revision 11427

bugfix: lib/runscripts/util.run: if is_dot_script, fix $ when no args causes this to incorrectly contain the script name. use is_dot_script rather than the presence of $ args to decide whether to use @BASH_ARGV, because @BASH_ARGV is actually wrong when run as a .-script (it contains the script name).

View differences:

util.run
28 28

  
29 29
#### setup
30 30

  
31
include_args=("$@") # from `. .../util.run "$@"`
31
if is_dot_script; then
32
	if test "$1" = .; then set --; fi # $@ wrong: no args->contains script name
33
	include_args=("$@") # from `. .../util.run "$@"`
34
fi
32 35

  
33 36
run_args_cmd() # runs the command line args command
34 37
{
35
	set -- "${include_args[@]}"
36
	test $# -gt 0 || eval set -- "$(reverse "${BASH_ARGV[@]}")"
37
		# in case including script didn't pass along "$@"
38
	if is_dot_script; then set -- "${include_args[@]}"
39
	else              eval set -- "$(reverse "${BASH_ARGV[@]}")"
40
	fi
38 41
	test $# -ge 1 || set -- all
39 42
	echo_cmd "$top_script" "$@"; time "$@"
40 43
}

Also available in: Unified diff