Unquoted ${v:+ARG} operator allows single-quoted strings
in ARG:

$ x=a; echo ${x:+'b c'}
b c

In this case, obviously single quotes must be paired.

If ${v:+ARG} is in double-quoted string, single quotes lose their special 
status:

$ x=a; echo "${x:+'b c'}"
'b c'

IOW: they work similarly to ordinary dquoted strings: echo "It's sunny"
treats single quote as ordinary char.

However, bash errors out if they are not paired:

$ x=a; echo "${x:+'b c}"
         <------------- bash thinks 'str' did not end yet

Most other shells - dash, mksh, busybox ash, posh, bosh -
do not require paired single quotes in this case:

$ dash
$ x=a; echo "${x:+'b c}"
'b c

From all tested shells, only yash behaves like bash.

I think it's a bug.

Reply via email to