#!/bin/bash set -e echo "This is a command before an error" command_that_fails # If this command fails, the script will exit immediately echo "This line will not be reached if the previous command fails"