News for hackers. Stuff that matters.
Re:How do I prevent accidental rm -rf /*? by barrkel on Saturday December 03, 2011 @07:57PM (#3309451)
If I'm going to be doing something major to a lot of files, I often write a script that outputs the commands to execute, so I can verify what's going to be done. Then I reexecute and pipe to bash.

It's not quite applicable to something used as off-handedly as rm, though it could be done. Something like:

    make-rm -rf /*
might produce output like:

    rm /usr/bin/a
    rm /usr/bin/b
    # ...
    rmdir /usr/bin
    rm /usr/lib/a
    #...
And so on. That can then be piped to bash as a confirmation.

There are no comments on this comment yet.