#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
network="222.88.95"
for ip in $(seq 1 255)
do
ping -c 1 -w 1 ${network}.${ip} &>/dev/null &&result=0 || result=1
if [ "$result" == "0" ];then
echo "$network.$ip is up"
else
echo "$network.$ip is down"
fi
done
时间: 2024-10-12 07:26:19