bash debug

Run bash scripts in a safer way.

bash -x      调试执行
bash -n      测试语法
set -e 异常时马上退出
set -u 把所有未定义的变量视为错误
set -x debug开关
set -o pipefail 在管道连接的命令中,只要有任何一个命令失败(返回值非 0),则整个管道操作被视为失败

set -euxo pipefail

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try my iOS App