#!/bin/bash# {start..end}会由shell对其进行扩展生成一组ip地址for ip in 192.168.0.{1..255} ;do ping $ip -c 2 &> /dev/null ; # $?获取退出状态,顺利退出则为0 if [ $? -eq 0 ]; then echo $ip is alive fidone
https://zhhll.icu/2022/linux/实用shell/列出网络上所有活动的主机/
本文由 mdnice 多平台发布
京公网安备 11010502049817号