脚本测试网站是否存活
创建一个文件夹将所有网站信息存进去 curl.txt : www.baidu.com www.hao123.com www.dahfhnjks.com
#!/bin/bash check(){ code=`curl -I -m 10 -o /dev/null -s -w %{http_code} http://${url}` if [ $code -eq 200 ]; then echo "ok" else echo "no" fi } :<<EOF for url in `cat url.txt` do check done EOF while read url do check done < url.txt