码迷,mamicode.com
首页 > 系统相关 > 详细

扫描局域网ip的shell

时间:2016-09-25 10:39:33      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

# vim /mysh/ipscan.sh 

#!/bin/bash
# scan the local alive ipaddress
# 2016-09-24


if [ -f $filename ];then
   echo "the file is exist" 
 for n in {100..106};do
      host=192.168.0.$n
      ping -c2 $host &>/dev/null
      if [ $? = 0 ];then
         echo "$host is up"
         echo "$host" >> /root/alive.txt
      else
          echo "$host is Down"
      fi
   done
      echo "------------------`date +"%Y-%m-%d"`-------------------------------"
 else
   echo "the file is not exist"
   touch /root/alive.txt
fi

   

扫描局域网ip的shell

标签:

原文地址:http://www.cnblogs.com/love3556/p/5905015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!