脚本如下
#!/bin/bash for ip in 192.168.10.{1..255}do (ping $ip -c2 &> /dev/null && echo -e "在线: $ip" || echo "***离线: $ip***")&done