Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  26] [ 0]  / answers: 1 / hits: 42450  / 3 Years ago, mon, july 26, 2021, 10:26:49

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?


More From » bash

 Answers
2

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.


[#29384] Tuesday, July 27, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oraoming

Total Points: 354
Total Questions: 105
Total Answers: 124

Location: Iraq
Member since Sat, Apr 3, 2021
3 Years ago
oraoming questions
Fri, Aug 20, 21, 10:08, 3 Years ago
Mon, May 24, 21, 21:56, 3 Years ago
Mon, Dec 12, 22, 23:21, 1 Year ago
Mon, Sep 12, 22, 11:38, 2 Years ago
;