Description
A bash script is a series of commands written in a file. These are read and executed by the bash command-line interpreter program. The program executes line by line. For example, you can navigate to a certain path, create a folder and spawn a process inside it using the command line.[1]
example
| 1 | 
 | 
setting options
- set -o <option>is the generic way to set various options.
errexit
- set -eis a shortcut for setting the- errexitoption.- set -o errexithas the same effect.
- The set -eoption instructs bash to immediately exit if any command has a non-zero exit status; subsequent lines of the script are not executed.[2]
- By default, bash does not do this… if it encounters a runtime error, it does not halt execution of the program; it keeps going and if one line in a script fails, but the last line succeeds, the whole script has a successful exit code.[2:1]
 
errtrace
- set -Eis a shortcut for setting the- errtraceoption.- set -o errtracehas the same effect.
- When errtraceis enabled, theERRtrap is also triggered when the error (a command returning a nonzero code) occurs inside a function or a subshell. Another way to put it is that the context of a function or a subshell does not inherit theERRtrap unlesserrtraceis enabled.[3]