4

I often see set -e or set -ex in dockerfiles and I was wondering what their purpose was. Recently, I've also seen set -o pipefail, and I have no idea what it does. I tried man set to see if there was any manual description, but there wasn't any and I am resorting to ask here.

Jens
  • 69,818
  • 15
  • 125
  • 179
hwkd
  • 2,411
  • 3
  • 18
  • 27

1 Answers1

8

You can find the full list here:
https://ss64.com/bash/set.html

-e

Exit immediately if a simple command exits with a non-zero status, unless the command that fails is part of an until or while loop, part of an if statement, part of a && or || list, or if the command's return status is being inverted using !. -o errexit

-x

Print a trace of simple commands and their arguments after they are expanded and before they are executed. -o xtrace

-o pipefail

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. This option is disabled by default.

Dan
  • 146
  • 4