[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty wo
From: |
Denys Vlasenko |
Subject: |
Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space |
Date: |
Fri, 20 Jul 2018 16:43:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
$ 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...
- Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space,
Denys Vlasenko <=