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


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

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

Started byChet Ramey <chet.ramey@case.edu>
First post2019-08-07 09:13 -0400
Last post2019-08-07 09:13 -0400
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Setting nullglob causes variables containing backslashes to be expanded to an empty string Chet Ramey <chet.ramey@case.edu> - 2019-08-07 09:13 -0400

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

FromChet Ramey <chet.ramey@case.edu>
Date2019-08-07 09:13 -0400
SubjectRe: Setting nullglob causes variables containing backslashes to be expanded to an empty string
Message-ID<mailman.990.1565183594.1985.bug-bash@gnu.org>
On 8/6/19 2:18 PM, 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:

Yes. Bash-5.0 changed so that backslashes in patterns are special
characters. This is what POSIX requires. There's more of an explanation
here:

https://lists.gnu.org/archive/html/bug-bash/2019-02/msg00151.html

So if patterns containing backslashes are patterns to be expanded (e.g.,
if the pattern is \x30 and there is a file named `x30' in the current
directory, the pattern should expand to `x30'), a failed pattern expansion
should be subject to the nullglob setting.

There is currently a ferocious -- well, it's mostly died down, but still
going on -- discussion on the POSIX mailing list about what POSIX *should*
say, but the current bash behavior is more-or-less -- POSIX doesn't have a
`nullglob' option -- what the POSIX shell group says should happen. I
assume there will be an interpretation for

http://austingroupbugs.net/view.php?id=1234

and I'll change bash to align with it.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


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


csiph-web