Created
April 18, 2018 03:32
-
-
Save huang5556019/41d4b46998605dbb64ac137025ef4fb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#在和脚本同目录下新建IPList.txt文件,并写入要测试的IP地址,保存后测试 | |
for i in `cat ./IPList.txt` | |
do | |
ping=`ping -c 1 $i|grep loss|awk '{print $6}'|awk -F "%" '{print $1}'` | |
if [ $ping -eq 100 ];then | |
echo ping $i fail | |
else | |
echo ping $i ok | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment