Hello,everyone
I'm a linux newbie from Shanghai.There's a question regarding $@ and $* which has confused me for a long time.Actually I have read the bash manual and some bibliographies,I found that they just talk about these two positional parameters' difference when they're double quoted.So what if they're assigned to a variable?
I've done some tests below.
Code:
set -- "First Arg" "Second" "Third:Arg" "" "Fifth: :Arg"
IFS=:
var=$@
var1=$*
echo "$var" # First Arg Second Third Arg Fifth Arg
echo "$var1" # First Arg:Second:Third:Arg::Fifth: :Arg
IFS=
var=$@
var1=$*
echo "$var" # First Arg Second Third:Arg Fifth: :Arg
echo "$var1" # First Arg Second Third:Arg FFiifftthh:: ::AArrg
It's too weird for me to understand.