I found the following snippet of bash script from How can I run a function from a script in command line?
$ cat test.sh
testA() {
echo "TEST A $1";
}
testB() {
echo "TEST B $2";
}
"$@"
This works well.
One of the response of this answer is Use "$@" in most cases. $@ is not safe in some cases
I'm wondering why $@
needs quotation marks, "$@"
, in the last line.
What makes it difference with or without quotation marks around $@
in the bash script?