ping ip地址
2019-06-21 本文已影响0人
独钓寒江sjl
#!/bin/bash
# author:shujiangle
cmd=$(cat ip.txt)
for i in $cmd
do
num=$(ping -c 5 $i | grep ttl | wc -l)
if [ $num == 5 ]
then
echo -e "$(ping -c 5 $i)"
echo -e "$i is yes" >> ping_ip.txt
else
echo -e "$(ping -c 5 $i)"
echo -e "$i is no" >> ping_ip.txt
fi
done