Apple User Help

Safe way to get “rm dir -rf” working (place options after dir name like on linux)

I don’t know how many times I’ve done it. I’ll type in rm dir and then have to move the cursor back and add in -rf to the command. Probably 10,000.

In linux, I can just add the options in after the dir name.

Is there any good bash magic that will let this safely happen? Here is a non-functional prototype of a simple bash rm function that I think would do the trick:

function rm() {
  if $2 eq "-rf" then run "builtin rm $2 $1"

But before I reinvent the wheel, I wanted to see if there were other options I’m missing. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *