?1. 编写一个shell脚本,判断192.168.1.0/24络内,在线的ip有哪些,能ping通就代表在线。
[root@shell scripts]# vim 001-judge_ip.sh
#!/bin/bash
for ip in $(seq 254)
do
ping -c 1 192.168.1.$ip &>/dev/null
if [ $? = 0 ];then
echo 192.168.1.$ip is online
fi
done
?
?
原文:https://www.cnblogs.com/ccbloom/p/11426852.html