The shell script practice nine thousand five hundred twenty-eight (a)

2019.08.28

 1. Write a shell script that judgment within 192.168.1.0/24 network, online ip what, can ping on behalf online.

[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



To be continued ......

Guess you like

Origin www.cnblogs.com/ccbloom/p/11426852.html