Make a shell script fail loudly

Bash

The four lines that turn a script from 'carries on after an error' into 'stops at the first problem'.

#!/usr/bin/env bash
set -Eeuo pipefail
trap 'echo "failed at line $LINENO" >&2' ERR
IFS=$'\n\t'

More in Shell

Random picks