pingres=`ping -c 1 baidu.com | sed -n '/64 bytes from/p'`
if [ -z "$pingres" ]
then
echo "network error"
exit 1
fi
用shell测试linux是否能连通外网
最新推荐文章于 2024-06-03 09:58:33 发布
pingres=`ping -c 1 baidu.com | sed -n '/64 bytes from/p'`
if [ -z "$pingres" ]
then
echo "network error"
exit 1
fi