sh里的-n参数可以使脚本不被执行,而检查语法。
[root@trffic root]# ls
a anaconda-ks.cfg install.log install.log.syslog test
[root@trffic root]# cat a
#!/bin/sh -n
cp install.log aa
if [ you == you ];then
echo "eco"
ifi
[root@trffic root]# ./a
./a: line 6: syntax error: unexpected end of file
[root@trffic root]# ls
a anaconda-ks.cfg install.log install.log.syslog test
阅读(820) | 评论(0) | 转发(0) |