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

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
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 Fri, 20 Jul 2018 16:43:10 +0200
Lines 31
Approved bug-bash@gnu.org
Message-ID <mailman.3901.1532097805.1292.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1532097806 18892 208.118.235.17 (20 Jul 2018 14:43:26 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
Content-Language en-US
X-Scanned-By MIMEDefang 2.78 on 10.11.54.4
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 20 Jul 2018 14:43:11 +0000 (UTC)
X-Greylist inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 20 Jul 2018 14:43:11 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dvlasenk@redhat.com' RCPT:''
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 66.187.233.73
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14372

Show key headers only | 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