1、脚本内容:
#vi hhh
添加以下内容:
#!/bin/bash read -p "Please keyin the network segment: (e.g. 10.88.1) " farm for i in `seq 2 255` do ip="$farm.$i" ping -c 3 $ip &> /dev/null if [ $? -eq 0 ];then echo -e "$ip is \e[32mUp\e[0m" else echo -e "$ip is \e[31mDown\e[0m" fi done
2、脚本使用:
时间: 2024-11-08 22:00:09