假设判断与 android.xx.xxx.com是否可以相连运行ping -c 3 -w 5 android.xx.xxx.com然后运行echo $?如果显示0说明主机android.xx.xxx.com可以连通如果显示非0(例如,显示1)说明主机android.xx.xxx.com不可连通ping -c 3 -w 5 android.xx.xxx.comif [[ $? != 0 ]];then echo " can not connect "fi