$@, both these bash special variables expands to the positional parameters, starting from the first one.
These variables are same (expand positional parameters in same way) when using without double quotes. If these variables are using inside double quotes, it will expand positional parameters differently.
$* within double quotes (
"$*") is equivalent to the list of positional parameters, separated by
":" and hence expansion of
"$*" will be like
$@ within a pair of double quotes (
"$@") is equivalent to the list of positional parameters separated by unquoted spaces, i.e.,
"$1" "$2".."$N". Or in other words, it is equivalent to the list of positional parameters where each parameters are double quoted.
For sake better understanding I wrote a script named
star_and_at.sh and pushed to my public github repo
You can clone my
bash github public repository directly using following command
git clone https://github.com/sukujgrg/bash.git