美文网首页
shell脚本--查询所有不在线的IP

shell脚本--查询所有不在线的IP

作者: w_dll | 来源:发表于2019-08-14 14:51 被阅读0次

脚本内容如下

#!/bin/bash
#date 0814
#mail gqoyvf@163.com
rm -f ip.txt
read -p 'input network number<xxx.xxx.xxx>:' network_number
for this_ip in {1..254}
do
    ping $network_number.$this_ip -c 3 | grep -q "ttl=" || echo "$network_number.$this_ip" >> ip.txt
done

执行方法

[root@localhost ~]# ./get_IP.sh 
input network number<xxx.xxx.xxx>:172.16.221

相关文章

网友评论

      本文标题:shell脚本--查询所有不在线的IP

      本文链接:https://www.haomeiwen.com/subject/qtvgjctx.html