Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14375
| From | Bob Proulx <bob@proulx.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space |
| Date | 2018-07-20 22:44 -0600 |
| Message-ID | <mailman.3946.1532148258.1292.bug-bash@gnu.org> (permalink) |
| References | <3d5b8d4b-b77e-2486-b45b-ca733e4d0ca0@redhat.com> |
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
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space Bob Proulx <bob@proulx.com> - 2018-07-20 22:44 -0600
csiph-web