I am new to bash and I am learning it and I have doubts about the real difference between using $@ and S* .
I'm here red bash Special options
I understand that both expand to positional parameters, but the difference occurs in double quotes. By the way, " $@ " = "$1" "$2"..."$n" may be different from "S*" = "$1$2...$n".
I am trying to figure this out with a simple script:
if [ $# -gt 0 ]; then echo "Your command line contains $# arguments" else echo "Your command line contains no arguments" exit fi echo "Params are: " echo $@ echo $* echo " $@ " echo "$*"
if I execute my script in a terminal like this ~./my_script par1 par2 par3
the result is always the same:
Params are: par1 par2 par3 par1 par2 par3 par1 par2 par3 par1 par2 par3
Perhaps I do not understand the real use of both special variables and if my example is true or not. I would also like to find this example with a good example.
source share