您好,登录后才能下订单哦!
!/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 "\033[32;49;1mup\033[39;49;0m"
echo -e "$ip_num.$i is up" >> ip_yes.txt
else
echo -e $ip_num.$i is "\033[40;31mdown\033[40;37m"
echo -e "$ip_num.$i is down" >> ip_no.txt
fi
}&
done
wait
sort -n -k 4 -t . ip_yes.txt -o ip_yes.txt
sort -n -k 4 -t . ip_no.txt -o ip_no.txt
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。