From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20653 invoked from network); 8 Jul 2006 18:37:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Jul 2006 18:37:18 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 45207 invoked from network); 8 Jul 2006 18:37:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Jul 2006 18:37:11 -0000 Received: (qmail 24405 invoked by alias); 8 Jul 2006 18:37:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10498 Received: (qmail 24396 invoked from network); 8 Jul 2006 18:37:03 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Jul 2006 18:37:03 -0000 Received: (qmail 44159 invoked from network); 8 Jul 2006 18:37:03 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 8 Jul 2006 18:37:03 -0000 Received: from torch.brasslantern.com ([71.116.74.94]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0J2300620L1CQ7P5@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Sat, 08 Jul 2006 13:36:49 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id k68IamXh008817 for ; Sat, 08 Jul 2006 11:36:48 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id k68IamVZ008816 for zsh-users@sunsite.dk; Sat, 08 Jul 2006 11:36:48 -0700 Date: Sat, 08 Jul 2006 11:36:46 -0700 From: Bart Schaefer Subject: Re: How to delete current directory In-reply-to: To: zsh-users@sunsite.dk Message-id: <060708113648.ZM8815@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <44AD1F50.8010705@ulpmm.u-strasbg.fr> <060706100353.ZM6522@torch.brasslantern.com> Comments: In reply to zzapper "Re: How to delete current directory" (Jul 7, 11:13am) On Jul 7, 11:13am, zzapper wrote: } Subject: Re: How to delete current directory } } > alias lrm='cd .. && rm -rf $OLDPWD' } > } > If for any reason the "cd" were to fail, unlikely as that may be, you } > wouldn't want to rm the wrong $OLDPWD. } > } > } Is there are mechanism in zsh which will allow the rm -r to start off in } confirm mode ie "do you want to delete this file" and then choose "all"?? unalias lrm function lrm { setopt localoptions glob_dots no_rm_star_silent cd .. || return rm -rf $OLDPWD/* && rmdir $OLDPWD [[ ! -d $OLDPWD ]] || { cd $OLDPWD && return 1 } } I rigged it so that if you say "no" you don't even change directories. You could even throw rm_start_wait onto the end of the setopt if you are extra-paranoid. Unfortunately saying "no" doesn't cause "rm" to return a failure status, so the "rmdir" is attempted either way. Aside to zsh-workers: It'd be nice if I didn't have to setopt glob_dots there, but rm -rf $OLDPWD/*(D) does not trigger rm_star handling because "*(D)" != "*". That seems a bad thing. --