When I’m writing a Latex file, sometimes I need to remove all files which were generated by its compilation and keep only the .tex file. Example, I want to remove all the following files:
paper-stack.log
paper-stack.blg
paper-stack.bbl
paper-stack.aux
paper-stack.pdf
and keep the following file:
paper-stack.tex
Besides that, I want to remove using bash regexp. I rememeber I did it before, but now I’m confused about the regexp patterns after using other shells. It was something like rm paper-stack.[!tex], but I’m not sure about the metacharacters [, ] and !.
If you have done
shopt extglobthen you can say something like(As usual when working with
rmor other potentially destructive commands, it’s a good idea to test withechofirst.) I would be more explicit about what to remove though, just on general principles.