set -x 与 set +x

#!/bin/bash
set -x            # activate debugging from here 从这里开始打印执行的命令及其参数
your other commands...
set +x            # stop debugging from here 从这里停止打印执行的命令及其参数
原文地址:https://www.cnblogs.com/chenjo/p/12719080.html