6 ms·
Gotta question why they used -f.
by enneff 12y ago
Gotta question why they used -f.
- frou_dh 12y agoIf all one is in the habit of using with a particular command is some single letter flags glommed together like that then it's possible to forget that they're actually separate flags.
- FranOntanaya 12y agoProbably to delete subfolders.
- unwind 12y agoThat's normal, but why the trailing slash?! That's just pointless, and almost looks like an explicit deathtrap. Without the slash, an empty variable would result in a command line of "rf -rf" which would simply fail due to the missing argument. There is absolutely no need for having a trailing slash, it's not as if "rf -rf foo" and "rm -rf foo/" can ever mean two different things, there can be only one "foo" in the file system after all. Very interesting way of introducing an epic fail with a single character, that really looks harmless.
- riquito 12y ago> it's not as if "rf -rf foo" and "rm -rf foo/" can ever mean two different things That's true, but the original code was akin "rm -rf foo/*" and that's different, since it removes the content of the directory while preserving it.
- teddyh 12y agoI have observed that ,any people feel that directories “need” to have a slash appended to them. They are afraid of ever doing, e.g. “cd /foo/bar” and will always do “cd /foo/bar/”. I”m guessing they feel like it would be some sort of type error, like treating a directory like a file or something. This behavior is especially common with regards to URLs; there are many flamewars about whether URLs “need” a trailing slash or not.
- pixelbeat 12y agoThe trailing /* is to delete the directory _contents_ rather than the dir itself. It would be safer to receate the dir as then you can possibly hit some of the inbuilt rm protections
- giggles_giggles 12y agoSo the script wouldn't pause and ask for user input during normal operation.
- enneff 12y agoBut why would the script prompt for user input unless something was awry? Presumably they control the contents of $STEAMROOT, so I don't see why rm -r should prompt unless it's about to do the wrong thing.
- Alupis 12y agomost systems have "alias rm='rm -i'" by default, so it would prompt on every single file regardless of ownership, etc.
- enneff 12y ago"most systems"? Not on Debian or Ubuntu, and that's most of them.
- smtddr 12y agofwiw, making those "-i" aliases to rm, mv and cp are one of the first things I do on any new Linux machine I'm on. I don't understand how anyone works in the very unforgiving-of-accidental-delete *nix world without those aliases.
- enneff 12y agoWith care.
- dietrichepp 12y ago99% of the time, my terminal is open to a git repo, and -i would just be more noise. The other 1% of the time I add the alias or use Nemo.
- jsnell 12y ago