Add "$*" and "$@" equivalent

This commit is contained in:
Steely Wing 2018-03-15 10:18:56 +08:00
parent 671057fabb
commit 23fff166d9
1 changed files with 10 additions and 5 deletions

View File

@ -8618,7 +8618,10 @@ echo "Your favorite song is $song."</programlisting>
<secondary>positional</secondary> <secondary>positional</secondary>
<tertiary>all</tertiary> <tertiary>all</tertiary>
</indexterm> </indexterm>
<para>All of the positional parameters, seen as a single word</para> <para>All of the positional parameters, seen as a single
word, <command>"$*"</command> is equivalent to
<command>"$1${IFS:0:1}$2${IFS:0:1}$3..."</command>
</para>
<note><para><quote><varname>$*</varname></quote> must be <note><para><quote><varname>$*</varname></quote> must be
quoted.</para></note> quoted.</para></note>
</listitem> </listitem>
@ -8640,10 +8643,12 @@ echo "Your favorite song is $song."</programlisting>
</indexterm> </indexterm>
<para>Same as <token>$*</token>, but each parameter is a <para>Same as <token>$*</token>, but each parameter is a
quoted string, that is, the parameters are passed on quoted string, that is, the parameters are passed on
intact, without interpretation or expansion. This means, intact, without interpretation or expansion. This means,
among other things, that each parameter in the argument among other things, that each parameter in the argument
list is seen as a separate word.</para> list is seen as a separate word, <command>"$@"</command>
is equivalent to <command>"$1" "$2" ...</command>
</para>
<note><para>Of course, <quote><varname>$@</varname></quote> <note><para>Of course, <quote><varname>$@</varname></quote>
should be quoted.</para></note> should be quoted.</para></note>