On 2/18/17 8:35 PM, Martijn Dekker 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.

It's an interesting question.  I'm ok with looking at the context of the
surrounding brace expansion, though field splitting isn't one of the
expansions Posix lists for the `word'.  The question is how other shells
rationalize differing behavior for differing parameter expansions.  For
instance, ${a#$*} expands $* as if it were not going to undergo field
splitting:

set -- a b
IFS=
x=abc
printf "<%s>\n" ${x#$*}

where, as you note, other expansions such as ${parameter+word} and
${parameter-word} do not.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to