Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to delete current directory
- X-seq: zsh-users 10498
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: How to delete current directory
- Date: Sat, 08 Jul 2006 11:36:46 -0700
- In-reply-to: <Xns97F97C669D040zzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns97F8725367A96zzappergmailcom@xxxxxxxxxxx> <44AD1F50.8010705@xxxxxxxxxxxxxxxxxx> <060706100353.ZM6522@xxxxxxxxxxxxxxxxxxxxxx> <Xns97F97C669D040zzappergmailcom@xxxxxxxxxxx>
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.
--
Messages sorted by:
Reverse Date,
Date,
Thread,
Author