"$@ in shell"

dgk at ulysses.UUCP dgk at ulysses.UUCP
Mon Aug 22 23:39:46 AEST 1983


I have received mail from a few who think that the Bourne shell is correct in
the expansion of "$@".  They rest their case on the line in the manual page
under Blank Interpretation, "Implicit null arguments ( those resulting from
parameter that have no values) are removed."
However, in the section on quoting it says that
"$@" is equivalent to "$1" "$2" ... .
If a shell script, script, consisting of the lines
	for i in "$@"
	do echo "$i"
	done
	for i in "$1" "$2" "$3"
	do echo "$i"
	done
is invoked as:
script 'line one' '' 'line three'
then the statement about quoting implies that the output should be:
line one

line three
line one

line three
The reason the rule on Blank Interpretation does not apply is the
$2 was an explicit null argument, not an implicit one.



More information about the Comp.unix.wizards mailing list