[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: !(.pattern) can match . and .. if dotglob is enabled

From: Chet Ramey
Subject: Re: !(.pattern) can match . and .. if dotglob is enabled
Date: Sat, 19 Jun 2021 13:54:27 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 6/17/21 3:41 PM, Nora Platiel wrote:
On 2021-06-15 09:43 Chet Ramey wrote:
I can see how this would be more intuitive. Let's try it. I'll put support
in the next devel branch push.


I'm leaning towards a general statement about how dotglob affects the set
of filenames that are tested against the extended patterns, rather than
calling out `!' specially.

What about this:
| The extended pattern matching operators cannot match the leading dot of
| filenames `.' and `..' (or any filename, if dotglob is unset) unless the
| _matching_ subpattern starts with a literal dot.

I decided on this:

When matching filenames, the \fBdotglob\fP shell option determines
the set of filenames that are tested:
when \fBdotglob\fP is enabled, the set of filenames includes all files
beginning with ``.'', but ``.'' and ``..'' must be matched by a
pattern or sub-pattern that begins with a dot;
when it is disabled, the set does not
include any filenames beginning with ``.'' unless the pattern
or sub-pattern begins with a ``.''.
As above, ``.'' only has a special meaning when matching filenames.

``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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]