JustBash.Commands.Set (JustBash v0.4.0)

View Source

The set builtin command - set or unset shell options.

Supported options:

  • -e / -o errexit: Exit immediately if a command exits with non-zero status
  • -u / -o nounset: Treat unset variables as an error
  • -o pipefail: Return value of a pipeline is the status of the last command to exit with non-zero status
  • +e, +u, +o errexit, etc.: Unset the option

Examples:

set -e           # Enable errexit
set +e           # Disable errexit
set -o pipefail  # Enable pipefail
set -eu          # Enable both errexit and nounset
set -euo pipefail # Enable all three