使用bash命令可以对bash脚本进行语法检测。

bash

        -n        对语法进行检测

        -x        显示运行过程


例:

bash  -n  demo.sh        检查语法

        demo.sh: line 15: syntax error: unexpected end of file


例:

bash  -x  demo.sh        显示运行过程

        ++ uniq

        ++ gawk -F, '{print $2}' test.txt

        + for team in '$(gawk -F, '\''{print $2}'\'' test.txt |uniq)'

        + gawk -v team=team1 'BEGIN{FS="," ; total=0}{