Bash Examples: Set Builtin
Last updated:Table of Contents
WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.
Force script to fail if any command fails
This prevents next commands from running in a bad state
#!/usr/bin/env bash
set -e
set -o pipefail
command1
# this will not run if command1 fails
command2
# other commands (will not run if ANY previous command fails)