Denys Vlasenko wrote:
> $ f() { for i; do echo "|$i|"; done; }
> $ x=x
> $ e=
> $ f ${x:+ ""}
> ^^^^^^^^^^^ prints nothing, bug?
>
> $ ${x:+"" }
> ^^^^^^^^^^^ prints nothing, bug?
Insufficient quoting. That argument should be quoted to avoid the
whitespace getting stripped. (Is that during word splitting phase
using the IFS? I think so.)
Try this:
f "${x:+ ""}"
f "${x:+"" }"
Also in the future please say what version of bash you are using.
There have been a lot of bugs fixed in various versions.
Bob