On Wed, Jun 21, 2017 at 10:30:22PM -0400, Chet Ramey wrote: > However, not all shells were consistent in their interpretation of the > Posix rules. For instance, dash, which bills itself as being completely > Posix conformant, produces 1 for that case (and expands to "ab"). The > Bourne shell (SVR4.2 version) produces 1 as well, but expands it > differently ("a b"). Debian's posh produces the same results as the Bourne > shell. And so on.
Oh, wow. I didn't realize it was quite this bad. $ dash $ set -- a b $ IFS= $ args $* 1 args: <ab> $ args $@ 1 args: <ab> $ args "$*" 1 args: <ab> $ args "$@" 2 args: <a> <b> $ ksh $ set -- a b $ IFS= $ args $* 2 args: <a> <b> $ args $@ 2 args: <a> <b> $ args "$*" 1 args: <ab> $ args "$@" 2 args: <a> <b> OK, going forward, I am officially considering any use of unquoted $* or $@ in a script to be a BUG, an invocation of undefined behavior, not acceptable, no excuses.