Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15303
| 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:39 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <20190806203955.nba45vjkmx5bu2a6@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> <20190806202819.3zpyixfptmqrdvgr@chaz.gmail.com> |
2019-08-06 21:28:20 +0100, Stephane Chazelas: [...] > 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). [...] with the current head of the devel branch, that behaviour can be disabled by turning off the posixglob option (I still do hope that POSIX will give up on this silly idea). $ a='\x30' ./bash +O posixglob -O nullglob -c 'printf "%s\n" $a' \x30 $ a='\x30' ./bash -O nullglob -c 'printf "%s\n" $a' $ a='\x30' ./bash -O nullglob -c 'printf "%s\n" $a' x30 In any case, yes, do remember to quote your variable expansions and not use echo for arbitrary data. -- Stephane
Back to gnu.bash.bug | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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