清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/bin/sh A=`cat ip.txt` echo "先将IP 分行写在ip.txt文件中,然后执行sh ping2.sh" for B in $A do str=`ping -c 3 $B` #echo $str ip_str=${str:4:14} loss=`echo $str|grep "100% packet loss"|wc -l` if [ $loss != 0 ] then echo "ping不通的IP#####:$ip_str" #echo $ip_str>>ipout.txt else echo "可以ping通的IP>>>>:$ip_str" fi done