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


Groups > gnu.bash.bug > #15302

Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string

From Stephane Chazelas <stephane.chazelas@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string
Date 2019-08-06 21:28 +0100
Organization A noiseless patient Spider
Message-ID <20190806202819.3zpyixfptmqrdvgr@chaz.gmail.com> (permalink)
References <5202404D-4B1E-4627-9FDE-2E0C5608A5B7@outlook.com> <20190806200021.GK1218@eeg.ccf.org> <mailman.968.1565121631.1985.bug-bash@gnu.org>

Show all headers | View raw


2019-08-06 16:00:21 -0400, Greg Wooledge:
> On Tue, Aug 06, 2019 at 06:18:27PM +0000, Mohamed Akram wrote:
> > Bash version: GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)
> > 
> > Example:
> > 
> > shopt -s nullglob
> > a='\x30'
> > echo $a
> > 
> > Expected output:
> > 
> > \x30
> > 
> > Actual output:
> > 
> 
> Also happens in bash 5.0 on Debian GNU/Linux.  It does not happen in
> bash 4.4 or earlier (I tried back to 3.2) on the same machine.
[...]

That is being discussed on the austingroup mailing list (and has
been discussed here before as well).

The idea is that in 5.0, \ became a globbing quoting operator.

So with nullglob, the \x30 expands to x30 when there's a file
called x30 in the current directory and nothing if not.

That is by design and was supported until relatively recently by
some Austin group people (the guys behind POSIX).

See http://austingroupbugs.net/view.php?id=1234 and the very
long discussions that follow on the mailing list:

See for instance
https://www.mail-archive.com/austin-group-l@opengroup.org/msg04237.html

-- 
Stephane

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


Thread

Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string Greg Wooledge <wooledg@eeg.ccf.org> - 2019-08-06 16:00 -0400
  Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-08-06 21:28 +0100
    Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-08-06 21:39 +0100
      Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-08-06 21:42 +0100

csiph-web