编写一个Shell, 判断192.168.1.1-10的主机是否在线
#!/bin/bash # Author: 电脑程序爱好者 # Date & Time: 2021-04-26 10:03:59 # Description: trap break INT # ctrl+c ,break loop for i in 192.168.1.{1..10}; do echo "begin to test $i" # ping 的参数 -c 3 意思是测试3次, if ! ping -c 3 $i &>/dev/null; then echo "$i" is off line. fi done
不忘初心,方得始终 --
The very beginning mind itself is the most accomplished mind of true enlightenment。

浙公网安备 33010602011771号