$@
–
Positional Parameters
$@
expands to the positional parameters $1
, $2
, etc. producing one field for each parameter.
$*
is similar, but only produces a single value, which contains all values at once.
Links
Examples
- Print positional parameters as multiple values
- Output:
1 2
set a b for p in "$@"; do echo "value: $p"; done
1 2
value: a value: b
- Print positional parameters as one value
- Output:
1 2
set a b for p in "$*"; do echo "value: $p"; done
1
value: a b
BashSuport Pro ist eine Bash und POSIX IDE mit Unterstützung für $@ – probieren Sie es aus!