{
  "$type": "site.standard.document",
  "canonicalUrl": "https://rednafi.com/misc/use-strict-mode-while-running-bash-scripts/",
  "description": "Enable Bash strict mode with set -euo pipefail to catch errors early. Exit on failures, treat unset variables as errors, and handle pipeline failures properly.",
  "path": "/misc/use-strict-mode-while-running-bash-scripts/",
  "publishedAt": "2021-11-08T00:00:00.000Z",
  "site": "at://did:plc:fgtm2c26vfcj74rfmeggbyqj/site.standard.publication/3mnl6f7ob462z",
  "tags": [
    "Shell",
    "Unix",
    "TIL",
    "Error Handling"
  ],
  "textContent": "Use unofficial bash strict mode while writing scripts. Bash has a few gotchas and this helps\nyou to avoid that. For example:\n\nWhere,\n\nFurther reading\n\n- [Unofficial bash strict mode]\n\n\n\n\n[unofficial bash strict mode]:\n    http://redsymbol.net/articles/unofficial-bash-strict-mode/",
  "title": "Use strict mode while running bash scripts"
}