bug-bash
[Top][All Lists]
Advanced

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

Re: ${b+s ''}


From: Chet Ramey
Subject: Re: ${b+s ''}
Date: Sun, 17 Feb 2019 20:07:06 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 2/16/19 11:38 AM, address@hidden wrote:
> I would like to include a null string as part of a parameter expansion word:
> 
>> mapfile -t${bNullDelimited+d ''}
> 
> When bNullDelimited is set, I expect this to expand to:
> 
>> mapfile -td ''
> 
> However, it expands to:
> 
>> mapfile -td

There are mixed behaviors. The idea behind the bash behavior is that a
null string added to a non-empty word is simply discarded, and this happens
while the word after the `+' is being processed, before word splitting.

bash/ksh93/zsh do it one way, ash-derived shells/mksh/yash do it another.

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



reply via email to

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