Reproducer:

IFS=/
set a b c
cat <<EOF
$*
EOF

Actual output: a b c
Expected output: a/b/c

In any context in which field splitting is not possible, POSIX specifies that $* uses the first character of $IFS as the output field separator. Here-documents are such a context.

I am fixing the same bug in ksh93 right now. Other shells (dash, mksh, yash, zsh) act correctly.

Interestingly, $* in a here-string already works correctly on both:

$ bash -c 'IFS=/; set a b c; cat <<<$*'
a/b/c
$ ksh93 -c 'IFS=/; set a b c; cat <<<$*'
a/b/c

--
||      modernish -- harness the shell
||      https://github.com/modernish/modernish
||
||      KornShell lives!
||      https://github.com/ksh93/ksh


Reply via email to