Y
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
Galanwe
901 days ago
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
link
metal
901 days ago
That's the point. You're not relying on it, it's a safety to save yourself from an unintended glob expansion.
link
Groxx
901 days ago
Or for far better reliability, just use safety and add that to the config.
link
While that may work for `rm -rf *`, it won't for `rm -rf foo/*`, `rm -rf foo`, etc