|
| From: | Chet Ramey |
| Subject: | Re: ${var:+foo "$empty"} |
| Date: | Sun, 23 Jan 2005 13:16:32 -0500 |
| User-agent: | Mozilla Thunderbird 0.9 (Windows/20041103) |
Stephane Chazelas wrote:
Hi,
$ bash -c 'printf "<%s>\n" ${$:+a "$a"}'
<a>
$ ksh -c 'printf "<%s>\n" ${$:+a "$a"}'
<a>
<>
$ dash -c 'printf "<%s>\n" ${$:+a "$a"}'
<a>
<>
I believe that bash is right. Posix says explicitly that the word on the rhs of the `+' does not undergo word splitting when it is used. I do not believe that Posix intended word splitting to be performed on the result. "$@" is the only expansion that's allowed to result in multiple words. And the way shells have behaved historically means that "$@" anywhere in a word enables the `special $@ mode' handling. Chet
| [Prev in Thread] | Current Thread | [Next in Thread] |