Skip to content

Instantly share code, notes, and snippets.

@goulashsoup
goulashsoup / error_handling.sh
Last active May 26, 2025 14:30
Bash strict mode script
#!/usr/bin/env bash
# Proper error handling for bash also known as "Bash Strict Mode"
# Usage: source 'error_handling.sh'
# https://gist.github.com/robin-a-meade/58d60124b88b60816e8349d1e3938615
# https://disconnected.systems/blog/another-bash-strict-mode/
if [ -n "${DEBUG:-}" ]; then
set -x
fi