4 ms·
>Line 468: rm -rf "$STEAMROOT/"* Oh man, reading that line made me cringe.
by MrMember 8y ago
>Line 468: rm -rf "$STEAMROOT/"*
Oh man, reading that line made me cringe.
- smhenderson 8y agoSeriously, how do you use rm -rf anywhere in a script without copious if statements? It's quite easy to avoid this mistake.
- schwap 8y agoOr maybe just `set -o nounset`
- xiphias2 8y agoIf you need an extra check in any API to do something really damaging, the problem is with the design of the API itself. I generally just prefer not using Bash scripting, as it's very hard to compose functionality in it.
- jakejarvis 8y agoTIL that this quick trick [1] also would have prevented this: ${STEAMROOT:?} ...where :? throws an error if the variable is unset or empty. (Still far too scary for my taste, though!) [1] https://github.com/koalaman/shellcheck/wiki/SC2115 https://github.com/koalaman/shellcheck/wiki/SC2115