Use unofficial bash strict mode while writing scripts. Bash has a few gotchas and this helps you to avoid that. For example:

#!/bin/bash

set -euo pipefail

echo "Hello"

Where,

-e              Exit immediately if a command exits with a non-zero status.
-u              Treat unset variables as an error when substituting.
-o pipefail     The return value of a pipeline is the status of
                the last command to exit with a non-zero status,
                or zero if no command exited with a non-zero status.

References

The idea is a less radical version of this post1. I don’t recommend messing with the IFS without a valid reason.

Recent posts

  • Escaping the template pattern hellscape in Python
  • Finding flow amid chaos
  • The diminishing half-life of knowledge
  • Oh my poor business logic
  • Pesky little scripts
  • Footnotes for the win
  • Dotfile stewardship for the indolent
  • An ode to the neo-grotesque web
  • Self-hosted Google Fonts in Hugo
  • Configuring options in Go