for循環, 0.1 -- 0.254 依次去ping,能通說明在線bash
#!/bin/baships="192.168.1."for i in seq 1 254doping -c 2 $ips$i >/dev/null 2>/dev/nullif [ $? == 0 ]thenecho "echo $ips$i is online"elseecho "echo $ips$i is not online"fidoneide
seq 1 254