I have a script that I found and I am trying to get it to run, it just downloads and install Apache runtime libraries. The first line is set -e
and it is causing an error; what does set -e
do?
I have a script that I found and I am trying to get it to run, it just downloads and install Apache runtime libraries. The first line is set -e
and it is causing an error; what does set -e
do?
This builtin is so complicated that it deserves its own section.
set
allows you to change the values of shell options and set the
positional parameters, or to display the names and values of shell
variables.
The -e
option
-e
Exit immediately if a pipeline (see Pipelines), which may consist of a
single simple command (see Simple Commands), a subshell command
enclosed in parentheses (see Command Grouping), or one of the commands
executed as part of a command list enclosed by braces (see Command
Grouping) returns a non-zero status. The shell does not exit if the
command that fails is part of the command list immediately following a
while or until keyword, part of the test in an if statement, part of
any command executed in a && or || list except the command following
the final && or ||, any command in a pipeline but the last, or if the
command’s return status is being inverted with !. A trap on ERR, if
set, is executed before the shell exits.
This option applies to the shell environment and each subshell
environment separately (see Command Execution Environment), and may
cause subshells to exit before executing all the commands in the
subshell.
Source: www.gnu.org
Edited due to @psusi's comment below.
Additionally you can read the bash's manual page
man bash
at the section: SHELL BUILTIN COMMANDS
or issue
help set
for a short help message.