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.
Thanks! > 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. The important part is "the matching subpattern" (not any subpattern). If there is no matching subpattern, or if the matching subpattern doesn't start with dot, then `.' and `..' are excluded (or all dot files, if dotglob is unset). E.g. both patterns `@(?|.foo*)' and `!(.foo*)', cannot match filename `.' because 1) the matching subpattern (`?') doesn't start with dot; 2) there is no matching subpattern. To further clarify we could also expand the definition of `!()' with something along these lines: | !(pattern-list) | Matches anything except one of the given patterns. |+ where anything is whatever `*' can expand to. The other operators don't have a notion of "anything except" so they don't need clarification. This is not a special case, just a consequence of the first statement. Regards, NP