-x 是调试用的,加了这个,就会把脚本中的每条命令的执行情况打印出来
hero@ubuntu:~/xuexi$ /bin/bash -x g + '[' a == b ']' + '[' a == a ']' + echo abc abc hero@ubuntu:~/xuexi$ cat g #!/bin/bash if [ "a" == "b" ] then echo yes elif [ "a" == "a" ] then echo abc else echo no fi hero@ubuntu:~/xuexi$