shell脚本步骤调试

第一种方式===>

[root@localhost functions]# sh -x test.sh --check xx
+ '[' --check '!=' -check ']'
+ case $1 in
+ base=xx
+ gotbase=yes
+ shift 2
+ '[' '' '!=' '' ']'

第二种方式===>
[root@localhost functions]# bash -vx test.sh -----  |less
while [ "$1" != "${1##[-+]}" ]; do                                        # daemon 函数本身可以指定多个选项,例如 --check <value> ,--check=<value> ,
   case $1 in
。。。。。。。。

+ '[' ----- '!=' ---- ']'
+ case $1 in
+ echo 'test.sh: Usage: daemon [+/-nicelevel] {program}'
+ return 1
test.sh: line 32: return: can only `return' from a function or sourced script
+ '[' ----- '!=' ---- ']'
+ case $1 in
第三种方式===>

参考shell文章中的Linux下PS1、PS2、PS3、PS4使用详解

原文地址:https://www.cnblogs.com/itcomputer/p/5010521.html