shell中ping域名是否存在

shell ping ip或者域名是否存在

ip=gc-server
if ping -c 1 $ip > /dev/null; then
      echo "$ip Ping is successful."
else
      echo "$ip Ping is failure"
fi
原文地址:https://www.cnblogs.com/cchilei/p/14144626.html