#!/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
网友评论