1. #!/bin/bash
    2. i=1
    3. while [ $i -le 254 ]
    4. do
    5. ping c2 i0.3 W1 192.168.4.$i &>/dev/null
    6. if [ $? eq 0 ];then
    7. echo "192.168.4.$i is up"
    8. else
    9. echo "192.168.4.$i is down"
    10. fi
    11. let i++
    12. done