Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created August 1, 2018 05:51
Show Gist options
  • Save ThaddeusJiang/575137e974477979be0272bfe855dfd5 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/575137e974477979be0272bfe855dfd5 to your computer and use it in GitHub Desktop.
Linux shell script set -x 作用

linux 脚本中可以使用 set -x 调试。

set -x 有详细的日志输出,可以避免不必要的 echo

set -x 开启 set +x 关闭 set -o 查看

set -x 执行后对整个脚本有效,所以 set -x 和 set +x 常常配套使用。

set -x            # activate debugging from here
w
set +x            # stop debugging from here

ref: https://blog.csdn.net/li575098618/article/details/49818493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment