-   Linux - Newbie (
-   -   What does the $@ represent in a bash script? (

danielj28 12-18-2007 02:46 PM

What does the $@ represent in a bash script?
I'm new to reading (and writing) bash scripts and I can't find any documentation for what the $@ parameter/variable represents and what value it receives. Please advise. Thanks.

pwc101 12-18-2007 03:18 PM


Originally Posted by man bash
@ 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 orig-
inal 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

It means each argument supplied to the script from the command line:

pwc101@linux:> ./myscript argument_1 argument_2
$@ represents argument_1 and argument_2 in that example, which can be individually referenced as $1 and $2.

See for more info.

danielj28 12-18-2007 07:37 PM

for the help!

PTrenholme 12-18-2007 07:51 PM

On most distributions the info command (in a terminal window) may be used to display information about a command. Did you try info bash?

If you're not familiar with the info command, try info info for an explanation.

chrism01 12-18-2007 11:56 PM

The nice version of the manual:

All times are GMT -5. The time now is 11:04 AM.