Somebody please tell me the difference between $@ and $*
Thanks in advance.
Saneesh Joseph
Somebody please tell me the difference between $@ and $*
Thanks in advance.
Saneesh Joseph
You can find the difference between $* and $@ only when you use them within quotes
$* will combine all arguments to a single string
$@ will have each arguments as a seperate string
See the below example
/export/home/test/mons>cat samp.sh
for i in "$*"
do
print $i
done
for i in "$@"
do
print $i
done
/export/home/test/mons>samp.sh hai welcome to "Unix Forum"
hai welcome to Unix Forum
hai
welcome
to
Unix Forum