linux shell脚本
来源:互联网 发布:js cells 编辑:程序博客网 时间:2024/06/06 03:40
#!/bin/sh
#cang
read -p "input run times:" times
echo "times=$times"
suc=0
err=0
tmp=""
while [ "$tmp" == "" ];do
tmp=$(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=0
fjiari=0
fsudong=0
fsuleng=0
if [ "$[16#$ftmp&16#02]" == "02" ];then
fzhineng=1
fi
if [ "$[16#$ftmp&16#04]" == "04" ];then
fjiari=1
fi
if [ "$[16#$ftmp&16#08]" == "08" ];then
fsudong=1
fi
if [ "$[16#$ftmp&16#10]" == "10" ];then
fsuleng=1
fi
echo "$fcang $fdong $fbian $fzhineng $fjiari $fsudong $fsuleng"
for loop in {0..10000};do
if [ $loop == $times ];then
echo "break"
break
fi
cang=$[$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" 10
adb shell input swipe 808 "$dongtmp" 808 "$dongtmp" 10
adb shell input swipe 630 "$biantmp" 630 "$biantmp" 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
tmp=""
while [ "$tmp" == "" ];do
tmp=$(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" ];then
suc=$[$suc+1]
#echo "suc=$suc"
else
err=$[$err+1]
#echo "err=$err"
fi
echo "times=$times,suc=$suc,err=$err"
done
#cang
read -p "input run times:" times
echo "times=$times"
suc=0
err=0
tmp=""
while [ "$tmp" == "" ];do
tmp=$(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=0
fjiari=0
fsudong=0
fsuleng=0
if [ "$[16#$ftmp&16#02]" == "02" ];then
fzhineng=1
fi
if [ "$[16#$ftmp&16#04]" == "04" ];then
fjiari=1
fi
if [ "$[16#$ftmp&16#08]" == "08" ];then
fsudong=1
fi
if [ "$[16#$ftmp&16#10]" == "10" ];then
fsuleng=1
fi
echo "$fcang $fdong $fbian $fzhineng $fjiari $fsudong $fsuleng"
for loop in {0..10000};do
if [ $loop == $times ];then
echo "break"
break
fi
cang=$[$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" 10
adb shell input swipe 808 "$dongtmp" 808 "$dongtmp" 10
adb shell input swipe 630 "$biantmp" 630 "$biantmp" 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
sleep 2s
adb shell input swipe 450 150 450 150 10
tmp=""
while [ "$tmp" == "" ];do
tmp=$(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" ];then
suc=$[$suc+1]
#echo "suc=$suc"
else
err=$[$err+1]
#echo "err=$err"
fi
echo "times=$times,suc=$suc,err=$err"
done
echo "times=$times,suc=$suc,err=$err"
简单版本:
#!/bin/sh
read -p "input run times:" times
echo "times=$times"
for loop in {0..10000};do
if [ $loop == $times ];then
echo "break"
break
fi
adb shell input tap 1100 352
sleep 0.5
adb shell input tap 165 727
done
#!/bin/sh
read -p "input run times:" times
echo "times=$times"
for loop in {0..100000};do
if [ $loop == $times ];then
echo "break"
break
fi
stime=$[$RANDOM%1001]*1000 stime表示微秒,这里代表从0-1秒之间取值
echo "stime=$stime"
adb shell input tap 968 96
usleep stime ——usleep代表微妙
adb shell input tap 73 721
done
0 0
- linux-shell:shell脚本范例
- [shell脚本] linux shell简介
- Linux shell 脚本
- linux shell 脚本入门
- Linux Shell脚本基础
- Linux shell 脚本
- Linux Shell脚本基础
- linux shell脚本入门
- Linux: shell 脚本入门
- linux脚本(shell)编程
- linux shell 脚本入门
- linux shell脚本学习
- linux脚本(shell)编程
- Linux Shell脚本学习
- Linux Shell 脚本
- LINUX SHELL脚本笔记
- linux shell 脚本
- Linux脚本Shell命令
- 不懂OpenGL还怎么嗨皮玩3D
- Servlet学习之Servlet中对象
- git打标签
- 用JMX监测JVM的运行参数
- iOS应用被杀死后继续获取用户地理位置
- linux shell脚本
- Linux声音系统
- Hibernate 一对一外键单向关联
- Java微信公众号简单使用
- pat-basic-1028-c语言
- 效果动画
- 关于Node.js后端架构的一点后知后觉
- VC中当鼠标停靠在按钮等控件上时出现文字提示功能
- spark 提交任务的时候指定名字