pingres=`ping -c 1 baidu.com | sed -n '/64 bytes from/p'` if [ -z "$pingres" ] then echo "network error" exit 1 fi