Using Unofficial bash Strict Mode

Aaron Maxwell has a blog post titled “Use the Unofficial Bash Strict Mode (Unless You Looove Debugging)” He claims a few simple script settings will make your bash scripts “more robust, reliable and maintainable” and I think he’s right.

Quoting Aaron:

Let’s start with the punchline. Your bash scripts will be more robust, reliable and maintainable if you start them like this:

#!/bin/bash
set -euo pipefail
IFS=$’\n\t’

 

There’s some good discussion on this technique at the ENHANCING THE (UNOFFICIAL) BASH STRICT MODE post if you want to read more on it.

This site uses Akismet to reduce spam. Learn how your comment data is processed.