3 ms·
This is why you should never run rm -r with the -f switch the first time. -f says yes to all warnings, including the ones that confirm that you really mean to e
by jschwartzi 11y ago
This is why you should never run rm -r with the -f switch the first time. -f says yes to all warnings, including the ones that confirm that you really mean to erase root. I see this constantly in SO and other answers, and it's a really really bad practice to do it without thinking.
- vilhelm_s 11y agoThis was inside a shellscript though. It could well be that the script e.g. needed to remove write-protected files, so the flag really had to be there.
- jschwartzi 11y agoEven in a script, would you really want it not to prompt you or fail under those conditions? Files are usually write-protected for a reason.
- nathancahill 11y agoI wish git was better about having a deletable directory. Most of the time that I need to use the -f switch, it's because I get this trying to remove a .git directory: rm: remove write-protected regular file?