shell多线程快速检测内网ip是否存活
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell多线程快速检测内网ip是否存活相关的知识,希望对你有一定的参考价值。
!/bin/bash
#Check the network is online
cat /dev/null > ip_yes.txt
cat /dev/null > ip_no.txt
ip_num="192.168.0"
read -p "Enter your network segment(Default ip: 192.168.0):" ip_num
if [ "$ip_num" = "" ];then
ip_num="192.168.0"
fi
echo "Please wait..."
for i in seq 1 254
do
{
ping -c2 -s1 $ip_num.$i >/dev/null
if [ $? -eq 0 ];then
echo -e $ip_num.$i is "