Y
Hacker News
new
|
ask
|
show
|
jobs
by
fragmede
641 days ago
Definitely don't check that a variable is non-empty before running
rm -rf ${VAR}/*
That's typically a great experience for shell scripts!
2 comments
teroshan
641 days ago
It happens to the best of us
https://github.com/ValveSoftware/steam-for-linux/issues/3671
link
ndsipa_pomu
640 days ago
Also, you'd want to put in a double dash to signify the end of arguments as otherwise someone could set VAR="--no-preserve-root " and truly trash the system. Also, ${VAR} needs to be in double quotes for something as dangerous as a "rm" command:
rm -rf -- "${VAR}"/*
link
https://github.com/ValveSoftware/steam-for-linux/issues/3671