On Thu, Aug 9, 2012 at 5:31 AM, Mark Kettenis <mark.kette...@xs4all.nl> wrote: >> Date: Thu, 9 Aug 2012 11:30:13 +0200 >> From: Landry Breuil <lan...@rhaalovely.net> ... >> in the context of https://bugzilla.mozilla.org/show_bug.cgi?id=781461 >> i've stumbled upon the following issue: >> (our pdksh) >> > $FOO=1 >> $cat <<EOF >> > echo ${FOO:+'blah'aa} >> > EOF >> echo blahaa >> >> bash-4.2# FOO=1 >> bash-4.2# cat <<EOF >> > echo ${FOO:+'blah'aa} >> > EOF >> echo 'blah'aa >> >> Apparently the ksh from solaris, hpux and debian don't strip the quotes >> in that usecase, and none of the other shells do (bash, dash, zsh...) >> >> So maybe it can be considered as a bug in our pdksh.. > > I think it is. POSIX says in 2.6.2 Parameter Expansion that: > > "...word shall be subjected to tilde expansion, parameter expansion, > command substitution, and arithmetic expansion." > > which suggests that quote removal isn't supposed to happen.
I agree. The bug applies to the simple double-quoted case too: $ foo=1 $ echo "${foo:+'blah'}" blah $ The correct output there should include the single-quotes, ala: 'blah' Philip Guenther