top | item 46634268

(no title)

rpigab | 1 month ago

It's a nice addition for certain use cases, however in the case of running "rm -rf ...", it has no effect because of the "-f / --force" flag set afterwards.

"rm -if" never prompts, "rm -fi" prompts. --preserve-root is an entirely different thing which will stop the command from deleting files even if you told it to.

  $ sudo rm -ri /
  rm: it is dangerous to operate recursively on '/'
  rm: use --no-preserve-root to override this failsafe
When in doubt, you might want to activate xtrace with "set -x", run the command and see what it expanded to. then "set +x" to disable.

discuss

order

zahlman|1 month ago

"It is dangerous to operate recursively on '/'" is such a stereotypically traditional Linux way to explain the situation.

(I would write something like "Refusing to delete the entire filesystem (did a shell variable expansion go wrong?)".)

rpigab|1 month ago

There's worse:

"Out of memory: Kill process or sacrifice child"