0

I would like to override a particular environment variable on a one-shot basis. The system currently has a variable for the "rm" command, forcing verification for each file. In general I am fine with this; it's saved me on a number of occasions.

However, it gets in the way sometimes. I have a large number of diagnostics files that are constantly generated and I periodically delete them. However, it takes forever to respond to the "rm: remove regular file `../logs/abort20150303013725_diag.txt'?" for every one of hundreds of files.

In this case I know I want to delete all of the files. There has to be a way to say "ignore the environment variables and issue the command exactly how I enter it". Basically behave as if there was no environment variable for rm for that particular invokation. While keeping the "confirm all" operation unless explicitly overridden.

2
  • How exactly is the behaviour of rm changed? Is there an alias? A function? A script? What variables are you talking about?
    – choroba
    Commented Sep 9, 2015 at 14:35
  • type rm will show it is probably an alias. Use /bin/rm for example, or remove the alias with unalias rm.
    – meuh
    Commented Sep 9, 2015 at 14:39

2 Answers 2

0

most likely rm is an alias to rm -i.

  1. unalias rm (this will last for the current session)
  2. use \rm file (which use plain rm )
  3. /bin/rm
1
  • 3 appears to be the solution. It's a one-shot, which is exactly what I want. And it requires no changes to anything other than adding a few characters to the command.
    – user157426
    Commented Sep 9, 2015 at 15:12
0

First locate the command rm by typing which rm. An example of the output is:

alias rm='rm -i'
        /bin/rm

Then use the full command path for a one-shot solution. Based on the above output, you might type:

/bin/rm <your file to be removed> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .