Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The difference is subtle; <code>"$*"</code> creates one argument separated by the <code>$IFS</code> variable, while <code>"$@"</code> will expand into separate arguments. As an example, consider:</p> <pre><code>for i in "$@"; do echo "@ '$i'"; done for i in "$*"; do echo "* '$i'"; done </code></pre> <p>When run with multiple arguments:</p> <pre><code>./testvar foo bar baz 'long arg' @ 'foo' @ 'bar' @ 'baz' @ 'long arg' * 'foo bar baz long arg' </code></pre> <p>For more details:</p> <p><a href="http://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters" rel="noreferrer">http://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters</a></p> <p>$*</p> <p>Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the IFS special variable. That is, "$*" is equivalent to "$1c$2c...", where c is the first character of the value of the IFS variable. If IFS is unset, the parameters are separated by spaces. If IFS is null, the parameters are joined without intervening separators.</p> <p>$@</p> <p>Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" .... If the double-quoted expansion occurs within a word, the expansion of the first parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed). </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload