Re: !(.pattern) can match . and .. if dotglob is enabled
From:
Chet Ramey
Subject:
Re: !(.pattern) can match . and .. if dotglob is enabled
Date:
Wed, 26 May 2021 11:44:04 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1
On 5/25/21 8:58 PM, Nora Platiel wrote:
Bash Version: 5.1
Patch Level: 8
Release Status: release
Hello,
Repeat-By:
$ shopt -s dotglob extglob
$ echo !(.foo)
. .. .other files
The doc says: "The filenames '.' and '..' must always be matched explicitly, even if
dotglob is set."
When dotglob is enabled, the shell's pattern matcher interprets an extglob
pattern beginning with a literal `.' as specifying that files beginning
with a `.' should match, so the negated pattern matches `.' and `..'.
Also the pattern !(.foo) didn't match . and .. before version 4.3.0.