[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: |
Chet Ramey |
Subject: |
Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields |
Date: |
Fri, 24 Feb 2017 16:07:56 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 |
On 2/24/17 3:20 PM, Grisha Levit wrote:
>
>
> On Sat, Feb 18, 2017 at 8:35 PM, Martijn Dekker <martijn@inlv.org
> <mailto:martijn@inlv.org>> 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.
If you want the expansion to be aware of the value of IFS and whether or
field splitting will take place as a result, and I think that's the intent
of the example, then the part of the description of $* that details what
will happen when field splitting does not take place is active. That's
where it describes joining the positional parameters into a single string.
The question is whether it's the null IFS that's supposed to dictate
whether field splitting will be performed, or the context of the
expansion (e.g., whether it's on the RHS of an assignment statement). The
description of $@ makes the distinction between context and effect, but
the description of $* does not.
This was the result of a long discussion in October, 2014 that resulted in
Posix interpretation 888:
http://austingroupbugs.net/view.php?id=888
You might be able to find the discussion in a mailing list archive somewhere.
You might also want to send a message to the austin group and ask for a
discussion concerning that specific case.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields, Martijn Dekker, 2017/02/18
- Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields, Chet Ramey, 2017/02/19
- Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields, Grisha Levit, 2017/02/24
- Prev by Date:
Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields
- Next by Date:
Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields
- Previous by thread:
Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields
- Next by thread:
Re: [BUG] With null IFS, ${1+$*}, ${var-$*}, etc. don't generate fields
- Index(es):