清风细雨楼 Design By www.eepep.com

本机多个IP
复制代码 代码如下:
ifconfig | awk '/inet/{print $2}' | awk -F: '{print $2}' 

首先,先用这个来着

复制代码 代码如下:
CheckIPAddress()       
{
        echo $1 > /tmp/tmpserverip
        echo $1 |grep "^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$" > /dev/null
        if [ $"codetitle">复制代码 代码如下:
grep "^([01]"

输入ip,检查其是否满足的ip书写规范,即不能大于255,不能有字母,和其他标点,参考网上的,自己搞了个如下,做个标记!@
复制代码 代码如下:
echo -n 'Enter the Server-ip:'
        read BISSip
        echo $BISSip > /tmp/tmpserverip
        echo $BISSip|grep "^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$" > /dev/null
        num=$?
        if [ $num = 1 ]
        then
                echo error ip,please enter correct
      
        else
  {
        a=$(cut -d. -f1 /tmp/tmpserverip)
        b=$(cut -d. -f2 /tmp/tmpserverip)
        c=$(cut -d. -f3 /tmp/tmpserverip)
        d=$(cut -d. -f4 /tmp/tmpserverip)
  
        {
                if [ $a -ge 255 ]||[ $a -le 0 ]
                then
                        echo a:error ip
                else
                        echo 1 > /tmp/jack
                 fi
        }
  
        {
                if [ $b -ge 255 ]||[ $b -lt 0 ]
                then
                        echo b:error ip
        else
                        echo 1 /tmp/jack
        fi
  
        }
   
        { if [ $c -ge 255 ]||[ $c -lt 0 ]
                 then
                         echo c:error ip
                else
                        echo 1 /tmp/jack
                    fi
         }
  
         { if [ $d -ge 255 ]||[ $d -le 0 ]
                then
                        echo d:error ip
                else
                        echo 1 /tmp/jack
                fi
         }

清风细雨楼 Design By www.eepep.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
清风细雨楼 Design By www.eepep.com