1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
#20170824
#Check the network is online
read
-p
"Enter your network segment(example 192.168.1.):"
ip_num
echo
"Please wait..."
for
i
in
`
seq
1 254`
do
ping
-c 2 -W 1 $ip_num$i >
/dev/null
if
[ $? -
eq
0 ];
then
echo
"echo $ip_num$i is up"
echo
$ip_num$i is up > ip_yes.txt
else
echo
"echo $ip_num$i is down"
echo
echo
$ip_num$i is down > ip_no.txt
fi
done
exit
0
|
本文转自 Innocence_caosm 51CTO博客,原文链接:http://blog.51cto.com/innocence/1958852,如需转载请自行联系原作者