What does $@ mean in a shell script?

trusktr picture trusktr · Apr 3, 2012 · Viewed 205.6k times · Source

What does a dollar sign followed by an at-sign (@) mean in a shell script?

For example:

umbrella_corp_options $@

Answer

Har picture Har · Apr 3, 2012

$@ is all of the parameters passed to the script.

For instance, if you call ./someScript.sh foo bar then $@ will be equal to foo bar.

If you do:

./someScript.sh foo bar

and then inside someScript.sh reference:

umbrella_corp_options "$@"

this will be passed to umbrella_corp_options with each individual parameter enclosed in double quotes, allowing to take parameters with blank space from the caller and pass them on.