首页 > 移动平台 > 详细

android手机执行shell脚本

时间:2019-09-30 21:46:15      阅读:346      评论:0      收藏:0      [点我收藏+]

注意:

1.手机必须root

2.shell脚本需要有执行权限

 

流程:

1.编写shell脚本

#!/system/bin/sh

i=1
while [ $i -le 100 ]
do
  let i++
  sleep 2
  input swipe 100 950 200 300 150
done

解释:每隔2秒滑屏一次,一共滑动100次(这个脚本比较简单,明白流程后可自行优化)

 

2.把shell脚本传到/data/目录(/system目录也可以)

adb push  D:\test_apk\test.sh   /data/
 

3.进入adb shell的root模式

技术分享图片

 

备注:#表示root模式

 

4.对shell脚本授权

1.进入/data/

2.chmod  777  test.sh

 

5.使用后台执行shell脚本

nohup ./test.sh &

 

备注:有的手机文件管理器不显示system目录,可以第三方的REguanliqi来查看系统目录

 

 

参考教程:

https://blog.csdn.net/wdz306ling/article/details/79602739.................shell

https://blog.51cto.com/11193863/2319105..............................shell

https://blog.csdn.net/MzTestor/article/details/79206427..............Android脱离USB执行Shell脚本

android手机执行shell脚本

原文:https://www.cnblogs.com/chen-xia/p/11614172.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!