Protection from the dreaded "rm -fr /"
Thomas Sparrevohn
Thomas.Sparrevohn at btinternet.com
Wed Oct 6 12:49:42 PDT 2004
On Wednesday 06 October 2004 02:31, Matthew Dillon wrote:
The university I used to work for had something like it and it got 99% of the
cases
> 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
> <dillon at backplane.com>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers
mailing list