From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 6 01:31:00 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 BF81916A4CE for ; Wed, 6 Oct 2004 01:31:00 +0000 (GMT) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9DAE943D48 for ; Wed, 6 Oct 2004 01:31:00 +0000 (GMT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) i961V0vA047975 for ; Tue, 5 Oct 2004 18:31:00 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.9p2/8.12.9/Submit) id i961V0pw047974; Tue, 5 Oct 2004 18:31:00 -0700 (PDT) (envelope-from dillon) Date: Tue, 5 Oct 2004 18:31:00 -0700 (PDT) From: Matthew Dillon Message-Id: <200410060131.i961V0pw047974@apollo.backplane.com> To: freebsd-hackers@freebsd.org References: <20041002081928.GA21439@gothmog.gr> <200410021123.59811.max@love2party.net> <20041002083336.GA10355@k7.mavetju> <20041002101842.GA23272@gothmog.gr> <20041005103123.C46325@duey.wolves.k12.mo.us> Subject: Re: Protection from the dreaded "rm -fr /" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list 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 01:31:00 -0000 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