[plug] zsh vs bash
Christian
christian at amnet.net.au
Mon Feb 12 19:24:28 WST 2001
On Mon, Feb 12, 2001 at 07:16:31PM +0800, Matt Kemner wrote:
> On Mon, 12 Feb 2001, Christian wrote:
>
> > Here's an idea for a cool shell feature... If you type an rm command by
> > itself on the command line the shell delays execution of that command
> > for 10 seconds although it takes you back to the shell prompt
> > immediately. Any time before the 10 seconds elapses you can cancel the
> > unlinking. This is probably scriptable I guess although not necessarily
> > cleanly/robustly. Anyone want to take a stab? :-)
>
> function rm() {
> (sleep 10;/bin/rm $*) &
> }
I'm not sure if this meets the specs. :-) The words "by itself" were
there deliberately. For example, what if I enter the command:
rm /var/cache/apt/archives/*.deb && apt-get dist-upgrade
I want the command to run immediately and the second part is clearly
dependent on the first. Am I correct in believing that the function
above will still pause? I guess my reasoning is that someone can easily
type a quick "rm *" without really thinking it through or being in the
wrong directory etc. but if they type in a big long command which chains
commands together then hopefully this isn't the case. (Of course, this
is debatable...)
Bonus points for speed of response though. :-)
More information about the plug
mailing list