【shell学习】扫描局域网IP的方法

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:74

[font=punctuation, 微软雅黑, Tohoma]#!/bin/bash

[font=punctuation, 微软雅黑, Tohoma]mynet="192.168.2"
[font=punctuation, 微软雅黑, Tohoma]num=1
[font=punctuation, 微软雅黑, Tohoma]for num in {1..254}
[font=punctuation, 微软雅黑, Tohoma]do
[font=punctuation, 微软雅黑, Tohoma] if ping $mynet.$num -c 1 &> /dev/null
[font=punctuation, 微软雅黑, Tohoma] then
[font=punctuation, 微软雅黑, Tohoma] echo "$mynet.$num is alived"
[font=punctuation, 微软雅黑, Tohoma] else
[font=punctuation, 微软雅黑, Tohoma] echo "$mynet.$num not is alived"
[font=punctuation, 微软雅黑, Tohoma] fi
[font=punctuation, 微软雅黑, Tohoma] num+=1
[font=punctuation, 微软雅黑, Tohoma]done

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】