This file contains hidden or 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 |
OlderNewer