标签:else online null ffline div 在线 输入 img one
#!/bin/bash #监控主机存活频率 echo -n -e "\t\t请输入查询的ip是否在线: " read IP for ((;;)); do ping $IP -c 2 &>/dev/null if [ $? -eq 0 ];then echo -e "\033[32m $IP is online \033[0m" else echo -e "\033[31m $IP is offline \033[0m" fi sleep 5 done
#!/bin/bash #监控主机是否存活 read -p "请输入需要查询的主机ip: " IP while true ; do ping $IP -c 1 &>/dev/null if [ $? -eq 0 ]; then echo -e "\033[32m $IP is online \033[0m" else echo -e "\033[31m $IP is offline \033[0m" fi sleep 3 done
标签:else online null ffline div 在线 输入 img one
原文地址:https://www.cnblogs.com/ccbyk-90/p/12726005.html