1. 程式人生 > >shell腳本之檢查局域網中在線的ip地址

shell腳本之檢查局域網中在線的ip地址

bash -c AR lse shel .sh 運行 class ip地址

[root@docker-node1 ]# cat ping.sh

#!/bin/bash
. /etc/init.d/functions
for var in {1..254};
do
ip=192.168.0.$var
ping -c2 $ip >/dev/null 2>&1
if [ $? = 0 ];then
action "$ip" /bin/true
else
action "$ip" /bin/false
fi
done

#運行腳本:

chmod +x ping.sh

sh ping.sh

shell腳本之檢查局域網中在線的ip地址