首页 > 学院 > 开发设计 > 正文

linux shell脚本

2019-11-09 16:46:20
字体:
来源:转载
供稿:网友
#!/bin/sh#cangread -p "input run times:" timesecho "times=$times"suc=0err=0tmp=""while [ "$tmp" == "" ];dotmp=$(adb shell logcat -d |grep "synccmd: aa 55 1e" |awk -F 'cmd: ' 'END{PRint $2}')done#echo "tmp=$tmp"fcang=$(echo "$tmp" |awk 'END{split($0,b," ");print b[13];}')fdong=$(echo "$tmp" |awk 'END{split($0,b," ");print b[14];}')fbian=$(echo "$tmp" |awk 'END{split($0,b," ");print b[15];}')ftmp=$(echo "$tmp" |awk 'END{split($0,b," ");print b[20];}')fzhineng=0fjiari=0fsudong=0fsuleng=0if [ "$[16#$ftmp&16#02]" == "02" ];thenfzhineng=1fiif [ "$[16#$ftmp&16#04]" == "04" ];thenfjiari=1fiif [ "$[16#$ftmp&16#08]" == "08" ];thenfsudong=1fiif [ "$[16#$ftmp&16#10]" == "10" ];thenfsuleng=1fiecho "$fcang $fdong $fbian $fzhineng $fjiari $fsudong $fsuleng"for loop in {0..10000};doif [ $loop == $times ];thenecho "break"breakficang=$[$RANDOM%9]cangtmp=$[560-$cang*35]dong=$[$RANDOM%9]dongtmp=$[560-$dong*35]bian=$[$RANDOM%24]biantmp=$[579-$bian*13]echo "cang=$cang,dong=$dong,bian=$bian"adb shell input swipe 448 "$cangtmp" 448 "$cangtmp" 10adb shell input swipe 808 "$dongtmp" 808 "$dongtmp" 10adb shell input swipe 630 "$biantmp" 630 "$biantmp" 10sleep 2sadb shell input swipe 450 150 450 150 10sleep 2sadb shell input swipe 450 150 450 150 10sleep 2sadb shell input swipe 450 150 450 150 10sleep 2sadb shell input swipe 450 150 450 150 10sleep 2sadb shell input swipe 450 150 450 150 10tmp=""while [ "$tmp" == "" ];dotmp=$(adb shell logcat -d |grep "synccmd: aa 55 1e" |awk -F 'cmd: ' 'END{print $2}')done#echo "tmp=$tmp"fcang=$(echo "$tmp" |awk 'END{split($0,b," ");print b[13];}')fdong=$(echo "$tmp" |awk 'END{split($0,b," ");print b[14];}')fbian=$(echo "$tmp" |awk 'END{split($0,b," ");print b[15];}')fcang=$[16#$fcang-2]fdong=$[16#$fdong-2]fbian=$[16#$fbian-3]if [ "$cang" == "$fcang" ] && [ "$dong" == "$fdong" ] && [ "$bian" == "$fbian" ];thensuc=$[$suc+1]#echo "suc=$suc"elseerr=$[$err+1]#echo "err=$err"fiecho "times=$times,suc=$suc,err=$err"done

echo "times=$times,suc=$suc,err=$err"

简单版本:

#!/bin/shread -p "input run times:" timesecho "times=$times"for loop in {0..10000};doif [ $loop == $times ];thenecho "break"breakfiadb shell input tap 1100 352sleep 0.5adb shell input tap 165 727done

#!/bin/shread -p "input run times:" timesecho "times=$times"for loop in {0..100000};doif [ $loop == $times ];thenecho "break"breakfistime=$[$RANDOM%1001]*1000  stime表示微秒,这里代表从0-1秒之间取值echo "stime=$stime"adb shell input tap 968 96usleep stime  ——usleep代表微妙adb shell input tap 73 721done


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表