用shell测试linux是否能连通外网

来源:互联网 发布:java 调用firefox内核 编辑:程序博客网 时间:2024/06/16 10:44
pingres=`ping -c 1 baidu.com | sed -n '/64 bytes from/p'`if [ -z "$pingres" ]then        echo "network error"         exit 1fi