WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.
Echo commands to stdout
Print every command you run to the terminal (standard output) using
#!/usr/bin/env bash set -x # other commands below
Abort if any command fails
This prevents next commands from running in a bad state
set -e and
set -o pipefail to make the full script abort and exit if any single command fails.
#!/usr/bin/env bash set -e set -o pipefail command1 # command2 will not be executed if command 1 fails command2
Set multiple options
set -ex to set both options,
x at the same time:
#!/usr/bin/env bash set -ex # both x and e options have been set