shell脚本实践之九五二八(一)

2019.08.28

 1. 编写一个shell脚本,判断192.168.1.0/24络内,在线的ip有哪些,能ping通就代表在线。

[root@shell scripts]# vim 001-judge_ip.sh
#!/bin/bash

for ip in $(seq 254)
do
  ping -c 1 192.168.1.$ip &>/dev/null
  if [ $? = 0 ];then
    echo 192.168.1.$ip is online
  fi
done



未完待续......

猜你喜欢

转载自www.cnblogs.com/ccbloom/p/11426852.html
今日推荐