Re: major blunders

From: Jared Still <>
Date: Wed, 7 Oct 2009 12:04:29 -0700
Message-ID: <>

On Wed, Oct 7, 2009 at 8:41 AM, April Sims <> wrote:

> Compiling a list of major blunders to avoid:
> Don't use the number 8 for scripting or ORACLE_SID due to the wild card
> character * above it.
> Don't use rm *.*

Here's a subtle variation on that.

Say you wish to delete all *.lis files in a directory.

The command would be "rm -f *.lis"

The problem with the *. combination is that the * requires using the Shift key, and the . does not require the shift key.

So, if your finger drags a little too long on the shift key, you end up with this:

   rm -f *>lis

Can you guess what happens?

Yes, you now have an directory with one empty file named "lis".

A lesson learned long ago, and you can probably guess how I learned it.

Fortunately, this lesson was learned well after the lesson on having good backups available...

Another thing I make use of when running potentially dangerous commands such as rm: use ls first.

Want to see what will be removed by rm -f *.txt?

First run ls *.txt

Then use command history and edit the command you just ran. This way you know the file specification is correct.

Same for shell scripts written to do mass maintenance.

Run it in 'dry run' mode before doing it for real.


for f in $( find . -name "stuff_i_do_not_want") do

   ls -ld $f
   # uncomment the rm when you are sure it is correct    # rm $f

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist Oracle Blog: Home Page:

Received on Wed Oct 07 2009 - 14:04:29 CDT

Original text of this message