[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The '*' variable question.
- To: misc@openbsd.org
- Subject: Re: The '*' variable question.
- From: Phil Pennock <Phil.Pennock@globnix.org>
- Date: Sun, 2 Sep 2001 18:43:17 +0200
- Content-Disposition: inline
- Mail-Followup-To: misc@openbsd.org
- References: <020e01c12fdb$5d895870$1601a8c0@andrey> <20010828185538.A24348@knott.ii.uib.no> <20010831185620.A18595@globnix.org>
- User-Agent: Mutt/1.2.5i
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]