Date: Thu, 22 Jun 2017 07:51:12 -0400
From: Greg Wooledge <[email protected]>
Message-ID: <[email protected]>
| $ dash
| $ set -- a b
| $ IFS=
| $ args $*
| 1 args: <ab>
That is simply broken. Always has been, whatever mistakes were
in the wording posix used to use to try and explain how it works.
| $ ksh
| $ set -- a b
| $ IFS=
| $ args $*
| 2 args: <a> <b>
This has always been the correct behaviour. There is no field splitting
happening, but when unquoted, there's no joining happening either.
$* is just $1 $2 ... (for as many params as set) as separate words.
That is, if you knew how many words existed, and wrote it out in longhand
in the first place. $* is just convenient when you don't know how many
params there are.
When quoted ("$*"), IFS[0] is used to turn the words into the string required,
when unquoted they are just words. "$@" is the one slightly weird special
case, but only because it is defined to be "$1" "$2" ... (for as many
params as exist, including 0).
kre