If the leader tells you to check the company when you're off duty. Those PCs are open, one to see? NO, it's too much trouble. The following script can quickly find the surviving PC through the ICMP ping packet, it is important to note that the local host will be the same as the subnet mask of the target host, and also at the same address bit.
#!/bin/bash
Read-p "Please enter start IP:" bigin_ip
Read-p "Please enter end IP:" over_ip
Ip_net= ' echo $bigin _ip|cut-d. -F 1-3 '
B_num= ' echo $bigin _ip|cut-d. -F 4 '
O_num= ' echo $over _ip|cut-d. -F 4 '
Echo $ip _net
Echo $b _num
Echo $o _num
For i in ' SEQ 1 3 '
Do
For b_cut in ' Echo $bigin _ip| Cut-d. -F $i '
Do
for O_cut in ' Echo $over _ip|cut-d. -F $i '
Do
If [$b _cut-ne $o _cut]
Then
echo "Please enter IP of the same address bit"
Else
While [$b _num-le $o _num]
Do
Ping-c 2-i 0.2 $ip _net. $b _num &>/dev/null
If [$? = 0]
Then
echo "$ip _net. $b _num is Alive"
Fi
Let b_num++
Done
Fi
Done
Done
Done
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/54/25/wKiom1R5cPqRs3w6AAC8Rkf_Xio308.jpg "title=" Qq20141129145817.png "alt=" Wkiom1r5cpqrs3w6aac8rkf_xio308.jpg "/>
This paper is transferred from Visia Comprehensive Forum: http://www.w4ya.com/thread-91-1-1.html
This article from "Dragon Love Xue Qi" blog, declined reprint!
Shell Check Company surviving PC