From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 6 19:49:42 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B116716A4CE for ; Wed, 6 Oct 2004 19:49:42 +0000 (GMT) Received: from smtp809.mail.ukl.yahoo.com (smtp809.mail.ukl.yahoo.com [217.12.12.199]) by mx1.FreeBSD.org (Postfix) with SMTP id 047E343D1F for ; Wed, 6 Oct 2004 19:49:42 +0000 (GMT) (envelope-from Thomas.Sparrevohn@btinternet.com) Received: from unknown (HELO w2fzz0vc01.aah-go-on.com) (thomas.sparrevohn@hg1.btinternet.com@81.157.165.54 with plain) by smtp809.mail.ukl.yahoo.com with SMTP; 6 Oct 2004 19:49:39 -0000 From: Thomas Sparrevohn To: freebsd-hackers@freebsd.org Date: Wed, 6 Oct 2004 20:49:09 +0100 User-Agent: KMail/1.7 References: <20041002081928.GA21439@gothmog.gr> <20041005103123.C46325@duey.wolves.k12.mo.us> <200410060131.i961V0pw047974@apollo.backplane.com> In-Reply-To: <200410060131.i961V0pw047974@apollo.backplane.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410062049.10154.Thomas.Sparrevohn@btinternet.com> Subject: Re: Protection from the dreaded "rm -fr /" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Thomas.Sparrevohn@btinternet.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2004 19:49:42 -0000 On Wednesday 06 October 2004 02:31, Matthew Dillon wrote: The university I used to work for had something like it and it got 99% of the cases > Yow. 78 messages and counting. Er, 79 now. I'll bet poor Giorgos > wishes he never started this thread! Get ready..... get set.... DIVE! > > A good friend of mine has, for at least the last two decades, used > something along the lines of: > > if ( $?prompt ) then > alias rm 'mv \!* $HOME/misc/trash' > endif > > However, it seems that the correct solution is to create a new option, > -I, which puts rm into 'idiot user mode' and has all the desired > confirmation effects listed in this thread and none of the undesired > effects such as -i returns. Then if anyone wants to use it they > can just create an alias similar to the above for -I and poof, problem > solved. It's fairly easy to detect '*' and ask for confirmation, > and also easy to ask for a single confirmation on a directory (not > ask again for any recursion). > > Then you guys can argue over whether the alias should appear in the > system-wide default csh.cshrc and friends, rather then argue over > the destruction of rm's basic nature. I will only point out that 'rm' > is used fairly universally in scripts and there are obviously things > other then '/' that you would want to ask confirmation for that just > as obviously cannot be made default operation for rm. > > -Matt > Matthew Dillon > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"