#!/bin/bash # net=‘192.168.141‘ uphost=0 downhost=0 for i in `seq 1 254`;do ping -c 1 -w 1 $net.$i &> /dev/null if [ $? -eq 0 ];then echo "$net.$i is up" let uphost++ else echo "$net.$i is down." let downhost++ fi done echo "up is $uphost" echo "down is $downhost"
时间: 2024-12-20 14:14:26