Seriously, how do you use rm -rf anywhere in a script without copious if statements? It's quite easy to avoid this mistake.
${STEAMROOT:?}
...where :? throws an error if the variable is unset or empty. (Still far too scary for my taste, though!) set -euo pipefail
as the first thing in your bash script which you absolutely should do every single time.I generally just prefer not using Bash scripting, as it's very hard to compose functionality in it.