`bash set -u # The script crashes if a variable is uninitialized set -e # The script crashes if the exit code of a command is not zero
`
- Use
"$@"
instead of$@
- Use quotes around filenames
- Use
mkdir -p
to create a full path - Use
rm || true
to avoid a non-zero exit - Use traps when using temporary files: