In 2015, Steam accidentally deleted all of a user's files on Linux due to a bug in a Bash script.

Why It Happened?
Moved ~/.local/share/steam. Ran steam. It deleted everything on system owned by user.
https://github.com/ValveSoftware/steam-for-linux/issues/3671#issuecomment-70159084 (accessed 2025-02-19)
rm -rf "$STEAMROOT/"*could be evaluated asrm -rf "/"*if$STEAMROOTis empty
The cause of the issue seemed to be in the way the zeroth argument passed by the shell was handled.
I believe the issue starts on line 19:
# figure out the absolute path to the script being run a bit # non-obvious, the ${0%/*} pulls the path out of $0, cd's into the # specified directory, then uses $PWD to figure out where that # directory lives - and all this in a subshell, so we don't affect # $PWD STEAMROOT="$(cd "${0%/*}" && echo $PWD)" STEAMDATA="$STEAMROOT"This probably returns as empty which mean:
https://github.com/ValveSoftware/steam-for-linux/issues/3671#issuecomment-70161790 (accessed 2025-03-06)rm -rf "$STEAMROOT/"*is the same assrm -rf "/"*.
Essentially, what has happened was that they wrote rm -rf "${0%/*}/*" to delete all files in the directory where a program was installed. If $0 (the zeroth argument) was /folder/program, then "${0%/*}" would evaluate to /folder. However, if $0 was just program, then "${0%/*}" would be an empty string "" , which means rm -rf "${0%/*}/*" evaluates to rm -rf /*, and that's how all files get deleted.