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


Groups > gnu.bash.bug > #14372 > unrolled thread

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

Started byDenys Vlasenko <dvlasenk@redhat.com>
First post2018-07-20 16:43 +0200
Last post2018-07-20 16:43 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  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

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

FromDenys Vlasenko <dvlasenk@redhat.com>
Date2018-07-20 16:43 +0200
SubjectEmpty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space
Message-ID<mailman.3901.1532097805.1292.bug-bash@gnu.org>
$ 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...

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web