文件中IP地址的检测脚本

#!/bin/bash

ip-check()

{

      ip=$1

      $ip | awk --posix '{ if  (  (  $0 ~ /^([0-9]{1,3}\.) {3}[0-9]{1,3}/ )   && ( $1<=255 )  && ( $2<=255 )  && ( $3<=255 ) && ( $4<=255 )  )

                   {print "this is IP "}

          else

                   {print "this is not ip"}

       } '

}