#!/bin/bashwhile true; do for i in {100..120};d o ping -c 2 -w 2 192.168.0. $I &>/dev/null if [ $? -eq 0 ];then echo -e "\033[32;40m 192.168.0. $I is up.\033[0m " else echo -e "\033[32;40m 192.168.0. $I is down.\033[0m" fi Done breakdone Execution Results [[email protected] ~]# sh ping.sh 192.168.0.100 is up. 192.168.0.101 is down. 192.168.0.102 is up. 192.168.0.103 is down. 192.168.0.104 is up. 192.168.0.105 is down. 192.168.0.106 is DOWN. 192.168.0.107 is DOWN. 192.168.0.108 is down. 192.168.0.109 is up. 192.168.0.110 is down. 192.168.0.111 is down. 192.168.0.112 is DOWN. 192.168.0.113 is DOWN. 192.168.0.114 is UP. 192.168.0.115 is up. 192.168.0.116 is down. 192.168.0.117 is down. 192.168.0.118 is up. 192.168.0.119 is down. 192.168.0.120 is up.
Implementing Scenarios using Ping
ping command parameters
-D uses the So_debug function of the socket.
-c< Completion > Set the number of responses required to complete.
-F limit detection.
-i< interval seconds > Specifies the time interval between sending and receiving information.
-i< Network Interface > send out packets using the specified network interface.
-l< pre-load > Set the packets that are sent forward before sending the required information.
-n outputs only numeric values.
-p< Template Style > Set the template style that fills the packet.
- Q does not display the instruction execution process, except for the beginning and end of the relevant information.
- R ignores the normal routing Table and sends the packet directly to the remote host.
-R records the routing process.
-s< Packet Size > Set the size of the packet.
-t< Survival value > Set the size of the Live value TTL.
-V shows the execution of the instruction in detail.
This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1943027
Using the shell to determine the local area network users have those