quangkeu95
11/7/2017 - 1:23 AM

Linux shell script: set -e and set -x

Linux shell script: set -e and set -x

Set -e and set -x in shell script

set -e:

Enable checking of all commands. The execution of shell script will be aborted if one command returns non-zero status code. Examples:

# true; echo $?
0 

# false; echo $?
1

set -x:

Trace the execution of all commands, it makes the interpreter print each commands in terminal before it is executed. Useful for debugging your shell script.

DEBIAN_FRONTEND="noninteractive"

Turn off debian frontend so no prompt during installation