[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The '*' variable question.



Correcting myself:

On 2001-08-31 at 18:56 +0200, I blathered:
> You might be thinking of $* for the parameters passed to a shell script;
> outside of double quotes, the parameters are subject to word-splitting
> (ie, are split on any run of characters in $IFS, which typically
> contains a space, a tab, and a newline).  Inside double-quotes, "$*" is
> the list of parameters joined by the first character of $IFS (ie,
> space, normally).  "$@" on the other hand is each character in turn, and

s/character/parameter/

> is thus the safe way to pass parameters on to another command,
> unmolested.  Neither $* nor $@ is sorted (unless using expansion
> modifiers, such as in zsh).

Looking at it again: "echo *" will join the parameters together, joined
by a space -- that's echo(1) doing the joining, not the '*'.  A more
likely explanation than the one which I originally gave.

Sorry for the list noise; shouldn't have tried thinking whilst becoming
feverish.
--
Failure to plan ahead on someone else's part does not constitute
an emergency on my part.  -- David W. Barts in the Monastery

[demime 0.98d removed an attachment of type application/pgp-signature]