Re: Inconsistent handling of patterns with backslah (`\`) escaping

Chet Ramey <[email protected]> Mon, 1 Jun 2026 11:43:11 -0400
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 6/1/26 11:24 AM, Grisha Levit wrote:
> On Mon, Jun 1, 2026, 11:14 Chet Ramey <[email protected]> wrote:
>>
>> On 6/1/26 6:54 AM, Andrei Borzenkov wrote:
>>> On Sun, May 31, 2026 at 5:32 PM Andreas Schwab <[email protected]> wrote:
>>
>>>> Because '\*' is not a glob, so filename expansion is not performed.
>>>>
>>>
>>> Actually it is. Pathname expansion is performed on the result of the
>>> parameter expansion and pathname expansion interprets the current
>>> content of the word in question as pattern:
>>
>> It's not, since the `*' in the word is not "treated as special" with
>> respect to pattern matching.
> 
> Or maybe one could say that pathname expansion is "performed," but is a
> no-op, per #4 of the list in 2.14.3:
> 
>      If a specified pattern does not contain any '*', '?' or '['
>      characters that will be treated as special, the pattern string
>      shall be left unchanged

Yes, pretty much the same thing, but I like the rationale because it says
the matching doesn't take place at all if the special pattern character
isn't treated as special (just a little more straightforward).

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCah2ojwUDAAAAAAAKCRC7WGnwZOp0qzB/
AJ93CTtKgPsrGn3lK0BzQwSK5EKiAwCfS3mO3vkNJ27OEdGSSxVxHHx0mnI=
=uMfk
-----END PGP SIGNATURE-----