ping測試某網段網絡連通性bash
#!/bin/bash for i in `seq 1 14`;do ping 100.88.14.$i -c 2 >/dev/null if [ $? -eq 0 ];then echo "100.88.14.$i online" else echo "100.88.14.$i offline" fi done
#!/bin/bash for i in {1..8};do ping 100.88.14.$i -c 2 >/dev/null if [ $? -eq 0 ];then echo "100.88.14.$i online" else echo "100.88.14.$i offline" fi done