I have shopt -s globstar extglob in my ./bashrc. I'm searching for files that refer to  string Foo in the following command:grep -Fwn Foo /**/src/**/*.@(h|cpp)Now I want to except all refers from files Foo.h and Foo.cpp. The following is the command that gain this goalgrep -Fwn Foo /**/src/**/*.@(h|cpp) | grep -v Foo.h | grep -v Foo.cppI'd like to make it without piping command using ! and & in location pattern. I mean something like the followinggrep -Fwn Foo /**/src/**/@(*.@(h|cpp)&(!(Foo.*)))Why the command from above do not work and how to fix it?
grepping with shopt -s globstar extglob
bash;wildcards
Simply because there's no such thing as a &(...) operator in bash. bash only implements a subset of ksh patterns with extglob. Here you want:grep -Fwn Foo /**/src/**/!(Foo).@(h|cpp)With ksh93, you can use & this way:grep -Fwn Foo /**/src/@(*.@(h|cpp)&!(Foo*))zsh has a and-not operator with extendedglob:grep -Fwn Foo /**/src/(*.(h|cpp)~Foo*)