3

As a precaution, I have in my .bashrc file the following alias:

alias rm='rm -i'

so it would ask me to confirm anytime I delete a file.

I often use find to remove files as well, generally with the following form:

find ./*dat -mmin +10 -exec rm "{}" \;

In this case, the rm command use is the original one as it does not ask my permission before deleting files. Most of the times I do not mind, but I would still like to know why it behaves like that and if it's possible to have find use my alias version of the command. For the rm case, I could just add the -i option, but this is what alias are for in the first place.

solalito
  • 1,189
  • 4
  • 19
  • 34
  • 2
    Interesting question! The [second answer](http://stackoverflow.com/a/7689221/1983854) in the duplicate covers this: `find . -exec ${BASH_ALIASES[rm]} {} \;` – fedorqui May 18 '16 at 08:58
  • 1
    Yes that works just fine! I don't know how I missed that question. Thanks – solalito May 18 '16 at 09:03

0 Answers0