#!/bin/bash
#Author:Sunshihe
#----------
#Time:2020-04-27 06:13:17
#Name:test06.sh
#Version:V1.0
#Description:This is a test script.
source /etc/init.d/functions
CMD="ping -W 2 -c 2"
IP=192.168.0.
for n in `seq 254`
do
$CMD $IP$n > /dev/null
if [ $? -eq 0 ];then
action "$IP$n is Ok" /bin/true
else
action "$IP$n is failed" /bin/false
fi
done
==================================================================================================
#!/bin/bash
#Author:Sunshihe
#----------
#Time:2020-04-27 06:33:44
#Name:test06_01.sh
#Version:V1.0
#Description:This is a test script.
CMD="nmap -sP "
IP=192.168.0.0/24
funcSecond(){
$CMD $IP|grep "Nmap scan report for"|awk -F "[ ]" '{print $5}'
}
funcSecond
==================================================================================================