iceman19860106 wrote:
> anybody help??
Clipped from here:
http://www.mpi-inf.mpg.de/~uwe/lehre/unixffb/quoting-guide.html
See section 3.1.7 if going there.
<snip>
In the Bourne shell, the positional parameters (or command line
arguments) can be accessed individually as $1, $2, ... . To access the
whole list of positional parameters, the two special parameters $* and
$@ are available. Outside of double quotes, these two are equivalent:
Both expand to the list of positional parameters starting with $1
(separated by spaces). Within double quotes, however, they differ: $*
within a pair of double quotes is equivalent to the list of positional
parameters, separated by quoted spaces, i.e., "$1 $2 ...". On the other
hand, $@ within a pair of double quotes is equivalent to the list of
positional parameters, separated by unquoted spaces, i.e., "$1" "$2"
..... (This is the behaviour if $IFS has its default value (space, tab,
newline). If $IFS has a non-standard value, the evaluation of $*, $@,
"$*", and "$@" is highly obscure, non-intuitive, badly documented, and
varying between different shells. Avoid it.)
What happens if the list of positional parameters is empty (i.e., $#
equals 0)? As one should expect, $* and $@ expand to nothing and "$*"
expands to one empty argument. The question is: what should "$@" be?
Originally, it expanded to one empty argument, just as "$*". But this is
somewhat inconsistent: it contradicts the usual rule that "$@" yields
exactly the list of all positional parameters originally passed to the
current program, i.e., a list whose length equals $#. (See Sect. 3.1.8
for a fix.) In most Bourne shells used today, the evaluation of "$@" has
been regularized, so that "$@" behaves in the way a programmer expects:
it expands to the list of all positional parameters, and in particular
it is expands to nothing if the list of positional parameters is empty.
<snip>
--
--> GNU/Linux is user friendly... it's just picky about its friends.