I'm trying the following globs in a bash shell:
$ ls -d .*
. .. .a .ab
$ ls .a*
.a .ab
$ ls .[!.]*
.a .ab
$ ls .[!.]?*
.ab
Shouldn't the last expression mean "a dot followed by exactly one non-dot followed by zero or more characters"? Why does it fail to match .a
?
Best Answer
You are mistaken. It means "a dot followed by exactly one non-dot followed by one character followed by zero or more characters".
.a
does not have enough characters to match it.But really, just set
dotglob
.