set -x debug shell

In the above results, in front of the line "+" sign is a shell script commands actually executed, in front of the line "+" sign is to perform the command specified trap mechanism, the other line is output.

In addition to the shell execution options can be specified at boot shell, but also in a script using the set command to specify. "Set - the parameter" means enable an option, "set + parameter" means to close an option. Sometimes we do not need to keep track of all the command line when you start with the "-x" option, then we can use the set command in a script, as shown in the following script fragment:

1
2
3
set -x    #启动"-x"选项
要跟踪的程序段
set +x     #关闭"-x"选项

Guess you like

Origin www.cnblogs.com/kakaisgood/p/11093207.html