deleting ugly file names (was Re: Ugly file name)

Randal L. Schwartz @ Stonehenge merlyn at intelob.intel.com
Wed May 17 00:16:17 AEST 1989


In article <2252 at Portia.Stanford.EDU>, joe at hanauma (Joe Dellinger) writes:
| Even "rm -i *" used to be dangerous. There is the famous case where
| somebody accidentally created a file name "-f", and decided to remove
| it by doing "rm -i *". The csh dutifully expanded this to
| "rm -i -f [files...]", and at that time "-f" overrode "-i" in rm.
| Result: everything in the directory deleted EXCEPT the file "-f"!
| Now -i overrides -f in rm, at least, but rm still interprets files
| beginning with a "-" as options instead of file names, even when expanded
| by the csh. I guess poor rm has no way of knowing what you typed and
| what the csh expanded.

Hasn't this one gotten into the folklore properly yet?  The *proper*
way to delete really nasty filenames is:

(1) find yourself a *dumb* terminal (at least something that doesn't
interpret control characters)

(2) cd to the directory where the beasty lives

(3) type "rm -ir ." CAREFULLY

(4) type a bunch of "n"s, followed by The One True "y" CAREFULLY
[the proper number of "n"s is left as an exercise to the reader]

(5) pour yourself a cold one (in my case, Classic Coke[tm])

No shell interpreter's gonna get in *my* way.  Works even on names
that have hi-bits set!  (Gurus know what I mean... if you don't know
what that is, don't ask.)

Just another UN*X Hacker,
-- 
***** PLEASE IGNORE THE ADDRESS IN THE HEADER *****
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\
{ <merlyn at agora.hf.intel.com> ...!uunet!agora.hf.intel.com!merlyn    }
\=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list