android phone shell script

note:

1. The phone must be root

2.shell script requires execute permissions

 

Process:

1. writing shell scripts

#!/system/bin/sh

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

Explanation: sliding screen once every 2 seconds, a total of 100 times the slide (this script is relatively simple, self-understood that the optimization process)

 

2. The shell script passed to / data / directory (/ system directory may be)

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

3. To enter the root adb shell mode

 

Note: # indicates root mode

 

4. Authorization for shell scripts

1. Go / data /

2.chmod  777  test.sh

 

5. Use the background shell script

nohup ./test.sh &

 

Note: Some phone File Manager does not display system directory, third party REguanliqi to view the system directory

 

 

Reference Tutorial:

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 Shell script execution from the USB

Guess you like

Origin www.cnblogs.com/chen-xia/p/11614172.html