This question already has an answer here:
I have wrote a simple script that takes in any number of parameters to demonstrate the difference between $@
and $*
:
#!/bin/bash
echo "double quoted $* $@"
echo 'single quoted $* $@'
On the CLI I did
$./stuff.sh a b c d e f dfs
And this is what prints out
double quoted a b c d e f dfs a b c d e f dfs
single quoted $* $@
Since they are identical does that mean $@
equals to $*
? Or is there a point I am missing?
From Special Parameters in Bash Reference Manual
Better with an example:
Technically,
$*
isn't limited to space-delimiting; it uses the first character of$IFS
. This can be used to your advantage:From http://linuxsig.org/files/bash_scripting.html:
so
so