Use set -u Use set -e Program defensively – expect the unexpected Setting traps Race conditions Be atomic