Stephane Chazelas <[email protected]> wrote, on 04 Jul 2019:
>
> 2019-07-04 09:26:50 +0100, Geoff Clare:
> [...]
> > > > a='*'
> > > > ls -ld "$a"
> > > >
> > > > This does work for listing only a file literally named '*'.
> > >
> > > That's because of the double quotes around $a. Pathname expansion
> > > is not done inside double quotes, so there is no pattern here, just
> > > a string that contains a '*'.
> >
> > Having said that, I now can't find the place in the standard that
> > covers this.
> >
> > Am I just not finding it, or is it genuinely missing?
> [...]
>
> See 2.6.2 parameter expansion:
>
> } If a parameter expansion occurs inside double-quotes:
> }
> } • Pathname expansion shall not be performed on the results of the
> expansion.
> }
> } • Field splitting shall not be performed on the results of the expansion.
Thanks!
It didn't occur to me that it might be down in the descriptions of
individual expansions.
The equivalent for command substitution is in 2.6.3 on line 75206:
If a command substitution occurs inside double-quotes, field
splitting and pathname expansion shall not be performed on the
results of the substitution.
> I'm sure there's something similar for ${a#"$b"} or case $a in ("$b")
Not that I can see.
I started thinking it would be better to handle this in 2.13.1, but
then realised it would be difficult to specify there given that 2.6.2
says "Enclosing the full parameter expansion string in double-quotes
shall not cause the following four varieties of pattern characters to
be quoted, whereas quoting characters within the braces shall have this
effect."
So I think we need to add something to that part of 2.6.2, and to
2.9.4.3.
--
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England