shell script追踪和调试
1. shell script调试
2. 检查语法错误
[work@www sh]$ sh -n for.sh for.sh: line 7: syntax error near unexpected token `o' for.sh: line 7: `o' [work@www sh]$
3. shell调试打印
[work@www sh]$ sh -v for.sh #!/bin/bash # desc : for loop for animal in dog cat pig do echo "HI, ${animal}" done HI, dog HI, cat HI, pig exit; [work@www sh]$
[work@www sh]$ sh -x for.sh + for animal in dog cat pig + echo 'HI, dog' HI, dog + for animal in dog cat pig + echo 'HI, cat' HI, cat + for animal in dog cat pig + echo 'HI, pig' HI, pig + exit [work@www sh]$
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。