5183 shaares
488 private links
488 private links
Q:
For example, suppose I want to ls all files that are not js. Probably I would do:
ls ! *.js
But I get errors for my ! operator.
How can I execute mv, rm, and any other operations with the not (!) operator?
A:
In the bash shell, you should enable extglob
and run ls !(*.js)
.
Example:
$ touch file.js file.txt
$ shopt -s extglob
$ ls !(*.js)
file.txt
You need to add it to your ~/.bashrc
if you want to set it permanently.