===== 假设有如下脚本check_alive.sh ===== **使用方法:./check_alive.sh 192.168.0 2 254** * $1 :ip前三位 * $2 :ip第四位起始值 * $3 :ip第四位末尾值 #!/bin/sh for ip in `seq $2 $3` do ( ping $1.$ip -c2 &> /dev/null if [ $? -eq 0 ]; then echo $1.$ip is alive else echo $1.$ip is down fi )& done wait