用户名: 密码: 忘记密码? 注册

检查一个范围内ip存活

作者:  时间: 2010-12-02
#!/bin/bash
i=0
      for var in {1..254}
        do
           ping -c 2 192.168.1.$var >/dev/null 2>&1
           status=$?
        if [ $status = 0 ];then
           echo "ping 192.168.1.$var is up" >>up.txt
        else
            echo "ping 192.168.1.$var is down" >>down.txt
        fi
done