bug-bash
[Top][All Lists]
Advanced

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

Re: ${b+s ''}


From: sunnycemetery
Subject: Re: ${b+s ''}
Date: Tue, 19 Feb 2019 18:15:19 -0500
User-agent: Mutt/1.11.3 (2019-02-01)

On 2019-02-19 10:41, Greg Wooledge wrote:
On Sun, Feb 17, 2019 at 08:07:06PM -0500, Chet Ramey wrote:
On 2/16/19 11:38 AM, address@hidden wrote:
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.

Ugh.  Shells are so messy.

wooledg:~$ ksh
$ args ${PATH+d ''}
1 args: <d>

wooledg:~$ dash
$ args ${PATH+d ''}
2 args: <d> <>

Interesting. I will file this under fringe-case quirks. Thank you for sharing other shells' behavior.



reply via email to

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