$*
: Stores all the arguments that were entered on the command line ($1 $2 …).
"$@"
: Stores all the arguments that were entered on the command line, individually quoted ("$1" “$2” …).
[root@localhost shell]# cat arguments.sh
#!/bin/bash
echo "Using \"\$*\":"
for a in "$*"; do
echo $a;
done
echo -e "\nUsing \$*:"
for a in $*; do
echo $a;
done
echo -e "\nUsing \"\$@\":"
for a in "$@"; do
echo $a;
done
echo -e "\nUsing \$@:"
for a in $@; do
echo $a;
done
[root@localhost shell]# ./arguments.sh one two "three four"
Using "$*":
one two three four
Using $*:
one
two
three
four
Using "$@":
one
two
three four
Using $@:
one
two
three
four
[root@localhost shell]#