Hacker News new | ask | show | jobs
by metal 901 days ago
Do this in important directories for added safety: $ touch -- - i This creates a file called "-i" which will add the interactive flag, prompting you before deleting every file that rm was going to delete.
2 comments

That seems flaky at best. Basically you rely on "*" expansion to inject the -i.

While that may work for `rm -rf *`, it won't for `rm -rf foo/*`, `rm -rf foo`, etc

That's the point. You're not relying on it, it's a safety to save yourself from an unintended glob expansion.
Or for far better reliability, just use safety and add that to the config.