The tips and tricks below originally appeared as one of Google's "Testing on the Toilet" (TOTT) episodes. This is a revised and augmented version. Safer Scripting I start every bash script with the following prolog: #!/bin/bash set -o nounset set -o errexit This will take care of two very common errors: Referencing undefined variables (which default to "") Ignoring failing commands The two setting
![Better Bash Scripting in 15 Minutes](https://cdn-ak-scissors.b.st-hatena.com/image/square/cb40506c62a6fd3cd2c775299b4ba8e14a0da9e5/height=288;version=1;width=512/https%3A%2F%2Fblogger.googleusercontent.com%2Fimg%2Fb%2FR29vZ2xl%2FAVvXsEg4WS1liJgqTIeqd4xZGp5NWgVaQcOYrg-ExvFw2r6G4ASUe03UYQXJe08Q7qN6rVJFuYmAzaty5D5hGrEkC2zhKkzLf3wxkgDGaGJrz3zkeYzztmn9C4KVRl0bX7CBBYYf1G9JGxxPHvqJ%2Fw1200-h630-p-k-no-nu%2Fblank_computer_screen.png)