zoukankan      html  css  js  c++  java
  • ping不同网段的脚本

    #!/bin/bash
    PS3="需要ping的网段:"
    select ip in 192.168.20.1 192.168.130.1 172.16.1.1; do
             case $ip in
                   192.168.20.1)
                                            IP=(192.168.20.11 192.168.20.12 192.168.20.13)
                                            for IP in ${IP[*]}; do
                                                          ping -c1 -i0.2 $IP > /dev/null
                                                                          if [ $? -eq 0 ]; then
                                                                                        echo "$IP UP"
                                                                          else
                                                                                        echo "$IP DOWN"
                                                                          fi
                                             done
                   ;;
                  192.168.130.1)
                                            for IP in {140..200}; do
                                                           timeout 0.2 ping -c1 -i0.2 192.168.130.$IP &> /dev/null
                                                                          if [ $? -eq 0 ]; then
                                                                                        echo "192.168.130.$IP UP"
                                                                          else
                                                                                        echo "192.168.130.$IP DOWN"
                                                                           fi
                                             done
                   ;;
                  172.16.1.1)
                                            IP=(172.16.1.24 172.16.1.25 172.16.1.26 172.16.1.34 172.16.1.41 172.16.1.42 172.16.1.43 172.16.1.44 172.16.1.49 172.16.1.50 172.16.1.51 172.16.1.52)
                                            for ((i=0;i<${#IP[*]};i++)); do
                                                          ping -c1 -i0.2 ${IP[$i]} > /dev/null
                                                                           if [ $? -eq 0 ]; then
                                                                                        echo "${IP[$i]} UP"
                                                                           else
                                                                                        echo "${IP[$i]} DOWN"
                                                                           fi
                                            done
                   ;;
                   *)
                                           echo "IP 输入错误!!!"
                   esac
    done

  • 相关阅读:
    python
    python
    打开python自带IDLE出的问题
    Python GUI编程(Tkinter)8、CheckButton多选框控件
    Python GUI编程(Tkinter)7、带滚动条的Text
    Python GUI编程(Tkinter)6、Text控件
    Python GUI编程(Tkinter)5、点击按钮输出输入框中的内容
    Python GUI编程(Tkinter)4、Entry控件
    Python GUI编程(Tkinter)3、Button控件
    Python GUI编程(Tkinter)2、Label控件
  • 原文地址:https://www.cnblogs.com/zgqbky/p/15355942.html
Copyright © 2011-2022 走看看