Work the shell: handling errors and making scripts bulletproof