shell判断IP地址是否合法

#!/bin/bash
for i in ${cat $1};do
   ipcalc -cs $i
   if [  $? -eq 0 ];then
      echo $i
   else
      echo "ip address inlegal"
   fi

 

posted @ 2019-08-31 12:50  啦啦啦嘻嘻嘻  阅读(1158)  评论(0编辑  收藏  举报