logoalt Hacker News

denkmoontoday at 3:41 AM1 replyview on HN

rm has mollyguarding, that's why every invocation of rm you see on the internet is followed by -f


Replies

yjftsjthsd-htoday at 5:13 AM

I think that may be a combination of (IMHO unfortunate) factors:

* Yes, on some systems rm is aliased to rm -i by default.

* Some scripts will use rm -f because normal rm returns an error if the target already doesn't exist but -f doesn't care.

* Finally, sometimes files are just ... I think it's being marked read-only that does it? I've hit this while trying to rm a git checkout; you actually do need to add -f sometimes to succeed. So if you just add -f then it'll always work.