In bash, how to delete all the files starting with file
using file*
but keep file.txt
?
I tried this
shopt -s extglob
rm file* !(file.txt)
But the file.txt
is still deleted.
PS: I only need to delete the files starting with file
, not all the files. E.g. I want a file named food.txt
still kept.