1#!/bin/bash 2 3function test_wifi() { 4 ifconfig wlan0 down && ifconfig wlan0 up && ifconfig wlan0 | grep UP 5 if [ $? -ne 0 ];then 6 echo "The wifi test fail !!!" 7 dmesg > /data/wifi_dmesg.txt 8 exit 11 9 fi 10} 11 12function main() { 13 while true; do 14 test_wifi 15 sleep 1 16 cnt=$((cnt + 1)) 17 echo " 18 ################################################# 19 # The WiFi has been tuned on/off for $cnt times # 20 ################################################# 21 " 22 done 23} 24 25main 26