Suppose I have these files:
foo/bar/baz/test.js
foo/bar/baz/test.min.js
If I run:
shopt -s globstar
shopt -s extglob
echo foo/bar/**/*!(.min).js
...that will nonetheless match the test.min.js file.
How do I ignore it?
Suppose I have these files:
foo/bar/baz/test.js
foo/bar/baz/test.min.js
If I run:
shopt -s globstar
shopt -s extglob
echo foo/bar/**/*!(.min).js
...that will nonetheless match the test.min.js file.
How do I ignore it?
In an extglob, !(.min) matches anything that isn't exactly .min (as long it doesn't contain a /), and that includes the empty string!!!
So, when you test foo/bar/baz/test.min.js against the extglob foo/bar/**/*!(.min).js you get a hit because:
foo/bar/ matches foo/bar/**/ matches baz/* matches test.min!(.min) matches the empty string.js matches .jsIf the meaning that you want from !(.min) is in fact "anything that doesn't end with .min" then, in spoken language, that is the negation of "anything that ends with .min" (which translates to *.min in glob terms); so you just have to use !(*.min) to fix your issue:
foo/bar/**/!(*.min).js