#!/bin/bash #created by molewan 2017-07-23 Usage(){ echo $"USAGRE:/bin/bash $0" exit 1 } if [ "$#" -ne "0" ];then Usage fi CMD="ping -w 2 -c 2" IP="192.168.1." for n in `seq 1 254` do { $CMD $IP$n &> /dev/null if [ $? -eq 0 ];then echo "$IP$n is ok" fi }& #shell的并发检测,批量ping done
原文地址:http://blog.51cto.com/molewan/2054494