linux ping 并发执行

 

 

#!/bin/bash
IP="10.0.0."

for i in `seq 2 10`
do
{
    ping=`ping -c 2 -w 2 $IP$i > /dev/null`
    if [ $? -eq 0 ];then
     echo "ping $IP$i is up"
    else
        echo "ping $IP$i is down"
    fi } & 
done

  

  

posted @ 2019-12-29 00:42  Chris_huang  阅读(396)  评论(0编辑  收藏  举报
返回项部