Shell脚本之:检测局域网中存活的主机

| categories linux 

#!/bin/bash #usage :“ ./ping 192.168.100 ” prefix=$1 for n in {1..254} do host=$1.$n ping -c2 $host > /dev/null if [ $? = 0 ]; then echo “$host is up” else echo “$host is DOWN” echo “$host” » $1down.txt fi done


上一篇     下一篇