Reputation: 1445
What does $@
in unix shell script signify. For example:
A__JOB="$CLASS $@"
where $CLASS has my java class file name. So what might be the meaning of
$@.
What did I do? I Googled :) but $@ seems to be complex query for ir or maybe i do not know how to search google for special characters.
Upvotes: 0
Views: 75
Reputation: 121387
$@
is the value of all arguments passed.
For example, if you pass:
./script A B C D
then "$@" will be equal to "A" "B" "C" "D"
So it looks like the purpose is to passe all the arguments passed to the script directly to the java program.
From bash manual:
@ 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).
Upvotes: 2