Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: rfc patch, abort rm instead of only removing the * from the cmdline

On Aug 16,  1:49am, Mikael Magnusson wrote:
} It surprised me that this isn't already what happens, what do others think?
} Imagine for example the typo
} % rm -rf * /tmp
} Before, even if you said no to the prompt, it will remove all your
} files in /tmp.

On Aug 16,  6:14pm, Richard Hartmann wrote:
} Agree 100%! This must be changed asap!
} As Peter is on holidays, can Bart chip in on this?

Well ...

It having been this way for far more than a decade without anyone ever
complaining before, I'm not sure "asap!" really applies.

The existing behavior really is what Paul Falstad wanted the shell to
do, all those years ago.  Like several of the very oldest features,
it's rather woefully under-documented in the man pages.  If you want
to abort the whole command, you're supposed to interrupt it with ^C,
not answer "n" -- the prompt is really just to give you an extra moment
to think about what a stupid thing you might be about to do, not to
second-guess your entire command line; compare the RM_STAR_WAIT option
(which is a lot more recent).

That said, if it were going to be changed, Stephane's patch is better.

Ideally I suppose this prompt should work like the prompt for "correct",
giving you "nyae" as choices so you can choose to abort or to edit your
typo.  Then it would be more obvious that "n" was not going to entirely
whack the command.


Messages sorted by: Reverse Date, Date, Thread, Author