According to this page, $@ and $* do pretty much the same thing:
The $@ holds list of all arguments passed to the script.
The $* holds list of all arguments passed to the script.
After searching all the top hits in google, I'm not able to find any explanation why there would be 2 seemingly duplicate syntaxes.
They appear to work the same in my scripts.
cat foo.sh
#!/bin/bash
echo The parameters passed in are $@
echo The parameters passed in are $*
./foo.sh herp derp
The parameters passed in are herp derp
The parameters passed in are herp derp
- Is one preferred over the other?
- Why are there 2 builtin variables to do the exact same thing?
Additional sources
bash.cyberciti.biz