#!/bin/bash set -euo pipefail
set modifies the behavior of bash in specific ways.
man bash for further details.
The following set options by default in bash scripts:
They have the following effects:
Exit immediately if a pipeline (which may consist of a single simple command), a list, or a compound command (see SHELL GRAMMAR above), exits with a non-zero status.
Treat unset variables and parameters other than the special parameters "@" and "*" as an error when performing parameter expansion.
If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully.
T. V. Eyck, “Safe bash scripts witih ’set -euxo pipefail.’” https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ , Mar-2015.