测试hosts文件中配置项

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/bash                     
#ping                        
                                
cat /etc/hosts | grep -v '^$' | grep -v '^#' | while read IP DOMAINS
do                              
    for DOMAIN in $DOMAINS      
       do                      
            ping -c1 $DOMAIN > /dev/null  2>&1
            printf "%-50s%-20s%d\n" $DOMAIN $IP $?                                                   
        done                    
done