dollar at
The special parameter $@, which in double quotes expands to every argument, or array element with ${arr[@]}, as a separate word.
In more detail
It is the correct way to pass a script's arguments on unchanged: "$@" keeps an argument with a space in it as one word. Without the quotes the arguments are split again and lose their boundaries. main "$@" at the end of a script hands every argument to the main function.
Example
report "$@"Related terms
- dollar star — The special parameter $*, which in double quotes joins every argument into one word separated by a space.
- positional parameters — The numbered variables $1, $2 and so on that hold the arguments given to a script or function, with $# holding how many there are.
- shell array — A variable that holds a numbered list of separate values, written in bash as names=(one "two words" three).
Taught in
- What Bash Does To A Line Before It Runs It — Bash Scripting & Command Line Automation
- Arrays, And Why Dollar At Is Not Dollar Star — Bash Scripting & Command Line Automation
- Arguments: Dollar One, Dollar At, shift — Bash Scripting & Command Line Automation
- Style That Prevents Bugs — Bash Scripting & Command Line Automation
- eval, And What To Use Instead — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation