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, sunnycemet...@gmail.com 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.