This question already has an answer here:
- Issue an error when using empty shell variables 3 answers
- How can I harden bash scripts against causing harm when changed in the future? 7 answers
- How can I safely ensure a variable contains only a valid filename? 3 answers
- Trivial rm -rf command destroys my operating system in a testing machine 3 answers
rm -rf in script could be catastrophic
rm -rf $TMP/$folder
when TMP and $folder are without any value , it will actually
removing all under "/"
so I am asking how to use the
rm -rf in the scripts so it will be safe?