Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14372

Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space

From Denys Vlasenko <dvlasenk@redhat.com>
Newsgroups gnu.bash.bug
Subject 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 16:43 +0200
Message-ID <mailman.3901.1532097805.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


$ f() { for i; do echo "|$i|"; done; }
$ x=x
$ e=

$  f ${x:+""}
||
^^^^^^^^^^^ correct

$ f ${x:+ ""}
^^^^^^^^^^^ prints nothing, bug?

$  ${x:+"" }
^^^^^^^^^^^ prints nothing, bug?

$ f ${x:+"$e"}
||
^^^^^^^^^^^ correct

$ f ${x:+ "$e"}
^^^^^^^^^^^ prints nothing, bug?

$ f ${x:+"$e""$e"""}
||
^^^^^^^^^^^ correct

$ f ${x:+"$e""$e"""}
^^^^^^^^^^^ prints nothing, bug?


Similarly with: f ${x:+"`echo`" } etc...

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space Denys Vlasenko <dvlasenk@redhat.com> - 2018-07-20 16:43 +0200

csiph-web