*BSD News Article 80529


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mel.aone.net.au!imci4!newsfeed.internetmci.com!howland.erols.net!news.mathworks.com!uunet!news-in2.uu.net!nwnews.wa.com!usenet
From: "Duane H. Hesser" <dhh@androcles.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: dummy question
Date: Sat, 12 Oct 1996 15:09:21 -0700
Organization: Northwest Nexus Inc.
Lines: 38
Message-ID: <32601711.41C67EA6@androcles.com>
References: <53mfdu$1iv@wa4phy.async.com>
NNTP-Posting-Host: androcles.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.1.0-RELEASE i386)

S.W. Drinkard wrote:
> 
> Ok, I'm not exactly a newbie, but I created a file with a filename of
> "--remove-files" due to a blunder of the fingers.  SysV would let me
> remove it in quotes, or by matching a wildcard patern.  I tried every
> combination of rm/mv/whatever short of the 45-cal pistol.  How does
> *bsd do it?
> 
> sheepishly,
> 
> -sam-
> 
> --
> World Traveler       |  International Lover   | Casual Hero
> Wars Fought          |  Opressor of Champions | Revolutions Started
> Aligators Castrated  |  Virgins Converted     | Governments Run

The simplest (but slightly dangerous) way to remove such file is using
the '-i' (interctive) option to 'rm'.  The command

rm -i *

will read the directory and present each name for confirmation before
removal.  You must answer 'y' to remove each item.  Any other response
leaves the file untouched.  It is likely that your 'funny file' will be
presented first; if not, just type returns until it is.  You can, of
course, just interrupt out after the file in question is removed.

One word of warning.  Some shells (e.g. zsh) will intercept the '*' and
ask you if you really want to revove everything.  NOTE that the shell
will respond immediately to the next character typed (no return
required).  If you type 'y' <CR> the command (rm) will get the return
and the first file presented will be skipped.

Be careful.
-- 
Duane H.Hesser
dhh@androcles.com