Re: major blunders

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: fmhabash@xxxxxxxxx
  • Date: Fri, 9 Oct 2009 10:44:36 -0700

On Fri, Oct 9, 2009 at 10:16 AM, Fmhabash <fmhabash@xxxxxxxxx> wrote:

> If I may add ...
>  - I altered behavior of 'rm' cmd forcing it to be interactive needing user
> confirmation. Scripts coded to use non-interactive version.
>

A trick to avoid accidentally deleting files you would rather keep.

Create a file called '-i' in key directories.  This will force rm -f to go
into interactive
mode, as the '-i' filename is interpreted as an argument.

Create '-i' file:  touch -- -i

The double dash is used to tell rm (or any other *nix command) that the
following stuff on the command line is not a command line option.

Remove the file:  rm -- -i

Create a tmp directory, copy a few files into it, and try it.

It has saved me at least once.


Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist
Oracle Blog: http://jkstill.blogspot.com
Home Page: http://jaredstill.com

Other related posts: