[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: !(.pattern) can match . and .. if dotglob is enabled
From: |
Nora Platiel |
Subject: |
Re: !(.pattern) can match . and .. if dotglob is enabled |
Date: |
Sun, 6 Jun 2021 17:18:28 +0200 |
In my previous message, I wrote:
> Yes, it all depends on the "universal set" from which the matches of the inner
> `pattern-list' are subtracted.
> But in the current implementation, the inner matches are subtracted from:
> - all files, if dotglob is set
> - all except dot files, if dotglob is unset
Sorry, I got mixed up here. From the above it would look like `.' and `..' are
never excluded from the matches of `!()' if dotglob is set.
Actually they are normally excluded (which is fine), but they are included back
again if at least one of the inner patterns starts with a literal dot.
From this sentence:
> !(pattern-list)
> Matches anything except one of the given patterns.
currently the definition of "anything" is affected not only by the value of
dotglob but also by the content of `pattern-list'.
I'm proposing that "anything" should be `*' (i.e. affected by dotglob but not
by `pattern-list').
The usual dot treatment is applied to the inner patterns themselves but it
doesn't make a difference in the final match.
E.g. the two patterns `!(.?)' and `!([.]?)' should have the same effect:
`.?' matches `..'
`[.]?' doesn't match `..'
but `*' minus `.?' is still equal to `*' minus `[.]?', because `*' matches
neither `.' nor `..' (and the final result should never include them).
My description of the desired behavior should still be sufficient.