How can I use inverse or negative wildcards when pattern matching in a unix/linux shell?
In Bash you can do it by enabling the extglob option, like this (replace ls with cp and add the target directory, of course) ~/foobar> shopt extglob extglob off ~/foobar> ls abar afoo bbar bfoo ~/foobar> ls !(b*) -bash: !: event not found ~/foobar> shopt -s extglob # Enables extglob ~/foobar> ls !(b*) abar afoo … Read more