I expected that:$ rm *(1)*would remove all files containing (1) in the name. I was wrong. It removed all files in the directory.Why?
Why does rm *(1)* remove all files in a directory?
bash;wildcards
From man bash:*(pattern-list)                 Matches zero or more occurrences of the given patternsYou have a glob expression which matches files beginning with zero or more 1s - which is all files.One simple way to disable this globbing behaviour is to \ escape the parentheses:rm *\(1\)*Otherwise you can use shopt -u extglob to disable the behaviour and shopt -s extglob to re-enable it:shopt -u extglobrm *(1)*shopt -s extglobNote that as Stephane says, extglob is enabled by bash-completion so disabling it may cause completion functions not to work properly.