Do not ignore user-supplied arguments.
idallen at watmath.UUCP
idallen at watmath.UUCP
Mon Mar 26 11:42:46 AEST 1984
>1. Any program is allowed to ignore extra arguments... It may not be all
>that polite in your opinion to ignore extra args, but "sh -c cmd" is not
>usually used by people, but by programs that don't appreciate the extra
>chatter. (For better or worse, "the UNIX way".) ...Rob Warnock
Where is it written that a feature of the UNIX operating system is that
programs may ignore "extra" arguments? I believe that it's a feature of
sloppy programming that they do, but I don't see it as a part of the O/S.
If I have a script that is supposed to pass a single argument to "sh -c
cmd", then I want to *know* when something screws up and more than one
arg is given. It's not politeness; if the args appear there, they're
there for a purpose, and the program is being presumptuous to ignore them.
If I wanted to pass only one arg, I'd do so in the first place.
>2. The "$@" construct is doing EXACTLY what it is documented to do.
>...Rob Warnock
I know about the documentation that says that "$@" expands to "$1" "$2", etc.
It doesn't say what "abc $@ def" should expand to. I can put forth a
case that the latter might expand to "abc" "$1" $2" ... "$N" "def", no?
--
-IAN! (Ian! D. Allen) University of Waterloo
More information about the Comp.unix
mailing list