On Sat, Feb 18, 2017 at 8:35 PM, Martijn Dekker <[email protected]> wrote:
>
> When IFS is null, unquoted $* within an unquoted substitution (e.g.
> ${1+$*} or ${unset_var-$*}) joins the PPs together into one field, as if
> either "$*" or the whole substitution were quoted.
>
> POSIX says the unquoted substitution is supposed to generate one field
> for each positional parameter, with further field splitting inactive due
> to empty IFS.
XRAT C.2.5 : Special Parameters [1] specifically addresses the case of
${unset_var-$*}. The following example is provided:
set "abc" "def ghi" "jkl"
IFS='' # null
unset var
printf '%s\n' ${var-$*}
abcdef ghijkl
..which seems to contradict your proposed expected output. It doesn't
specifically address ${1+$*}, but having ${1+$*} mirror the behavior of
${unset_var-$*} seems appropriate?
[1]
http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_05_02