Padwasabimasala

home

Better Bash Scripts

25 Jun 2014

A great Bash tip

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
- Ignoring failing commands

Thanks Robert