markdown Linux shell脚本:set -e和set -x

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Linux shell脚本:set -e和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

以上是关于markdown Linux shell脚本:set -e和set -x的主要内容,如果未能解决你的问题,请参考以下文章

markdown 有关shell脚本的提示

markdown zsh shell脚本提示

markdown Shell脚本最佳实践

markdown 有关trap命令的Shell脚本知识

markdown [shell] #linux

markdown Linux shell dictionary.md