shell脚本 查看ping是否通信

#!/bin/bash

for i in `seq 1 254`

do

  ping -c 1 192.168.72.$i > /dev/null

  if [ $? -eq 0 ]

  then

     echo: "192.168.72.$i存活"

  else

     echo: "192.168.72.$i不存活"

  fi

done

posted @ 2019-09-27 14:28  韬仔  阅读(2285)  评论(0)    收藏  举报