#如下,对一个网页进行简单的判断,看是否正常 #!/bin/bash fail=0 #success=0 while((fail<=2)) do wget--timeout=5--tries=1http://oldboy.blog.51cto.com-q-O/dev/null#timeout定义超时时间--tries定义尝试次数 a=$? if[$a-ne0] then letfail=fail+1 else echo"success" exit0 fi done echo"thisisafailadress"