小弟第一次写个Linux的Shell,目的也就是让程序判断443端口,8080端口是否正常,不正常的话启动相应的服务

内容如下:
#!/bin/bash
#program:
#This progrem auto check-up netsafe_log process and delete this process.

testing443=`(netstat -an | grep 443 )`
while [ "$testing443" = "" ]
do
/home/admin/Onion/Start443.sh
done

testing9002=`(netstat -an | grep 9002)`
while [ "$testing9002" = "" ]
do
/home/admin/Onion/Start9002.sh
done

但是总是报错:
: command not founde 4:
: command not founde 5:
: command not founde 6:
netsafe_log.sh: line 18: syntax error: unexpected end of file

请问这个是怎么回事?

while [ "$testing443" = "" ]中单个=号是赋值的意思,应换成==
载入/home/admin/Onion/Start443.sh 脚本的时候最好使用sh /home/admin/Onion/Start443.sh,或者使用source或者.(一个点)载入其他脚本。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-07-25
while [ "$testing443" = "" ]
空值比较不要这样使用,应该这样:
while [ "NULL$testing443" = "NULL" ]
第2个回答  2011-07-21
是“==”,不是“=”
第3个回答  2011-07-21
你把那些空格全部去掉 试试

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网