[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields

From: Grisha Levit
Subject: Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields
Date: Fri, 24 Feb 2017 15:20:10 -0500

On Sat, Feb 18, 2017 at 8:35 PM, Martijn Dekker <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]