Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fragmede
on Sept 13, 2024
|
parent
|
context
|
favorite
| on:
Techniques I use to create a great user experience...
Definitely don't check that a variable is non-empty before running
rm -rf ${VAR}/*
That's typically a great experience for shell scripts!
teroshan
on Sept 13, 2024
|
next
[–]
It happens to the best of us
https://github.com/ValveSoftware/steam-for-linux/issues/3671
ndsipa_pomu
on Sept 14, 2024
|
prev
[–]
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}"/*
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: