"$@ in shell"
David Elliott
dce at tekecs.UUCP
Mon Aug 22 04:01:37 AEST 1983
We here at Tektronix are "Committed To Changing The Bourne Shell".
(just kidding)
The original article noted that "$@" inside of a script does not
pass on null arguments. Example :
#!/bin/sh
# This script is called 'foo'.
a=0
for i in "$@"
do
echo "$i"
a=`expr $a + 1`
done
echo "Number of args is $a"
If you type 'foo a b c d e', you get
a
b
c
d
e
Number of args is 5
If you type 'foo a b c "" d e', you get
a
b
c
d
e
Number of args is 5
The original submitter said that they had changed 'ksh' (whatever the
hell that is. We have a ksh, too, but he couldn't have a copy of it)
and hoped that '6.0' sh would have this fixed.
Andy, the author of the article you saw and my boss, doesn't want
to change the shell. In fact, he's against it as much as you are.
(Neither of you are as adamant as I am, as I AM making some internal
mods to sh, which is my job.)
David
More information about the Comp.unix.wizards
mailing list