为了防止忘记较多命令,做一个.sh文件记载,简直不要太方便
第一步:首先创建一个文件,后缀改为.sh
第二步:然后给文件授权(直接授权可读可写可执行吧,方便):chmod 777 /location/xxx.sh
如果是Ubuntu系统:sudo chmod 777 /location/xxx.sh
第三步:接下来编辑.sh文件内容,把不常用,但时不时又要用一下的命令写进这个文件
———————————-我是可爱的分割线——————————————————-
#! /bin/bash
if [ $1 == “cpu” ]; then
adb shell cat /proc/cpuinfo
elif [[ $1 == “serialno” ]]; then
adb shell getprop persist.service.mdm.psn
elif [[ $1 == “wifimac” ]]; then
adb shell cat /sys/class/net/wlan0/address | pbcopy
adb shell cat /sys/class/net/wlan0/address
elif [[ $1 == “sn” ]]; then
adb shell getprop persist.service.mdm.psn | pbcopy
adb shell getprop persist.service.mdm.psn
elif [[ $1 == “activity” ]]; then
adb shell dumpsys activity > log.txt
open log.txt -a Sublime\ Text
elif [[ $1 == “screenshot” ]]; then
adb shell /system/bin/screencap -p /mnt/sdcard/screenshot.png
adb pull /mnt/sdcard/screenshot.png .
adb shell rm -rf /mnt/sdcard/screenshot.png
open screenshot.png
elif [[ $1 == “lct” ]]; then
adb logcat -v time >001.log
elif [[ $1 == ‘lcc’ ]]; then
adb logcat -c
elif [[ $1 == “amc” ]]; then
adb shell am force-stop xxx包名
elif [[ $1 == “ams” ]]; then
adb shell am start -n com.shishike.calm/.splash.calmlauncher.CalmHomeActivity_
elif [[ $1 == “reb” ]]; then
adb reboot
elif [[ $1 == “uisc” ]]; then
#statements
adb uninstall package
elif [[ $1 == “apc” ]]; then
adb pull /mnt/sdcard/Android/data/package/ .
elif [[ $1 == “scr25” ]]; then
adb shell screenrecord –bugreport –time-limit 40 /data/local/tmp/a1.mp4 &
sleep 46s
adb pull /data/local/tmp/a1.mp4 .
adb shell rm -rf /data/local/tmp/a1.mp4
else
echo “wrong param”
fi
——————————–我是可爱的分割线———————————————–
第四步:执行命令
比如在窗口中直接输入:./xxx.sh scr25
这条命令的意思就是执行scr=25这条命令,然后就会开启录屏40秒,等待46秒,拉取a1.mp4这个文件到电脑目录下,删除设备上a1.mp4这个文件
注释一下各命令意思
cpu:查看cpuinfo
serialno:获取设备属性
wifimac:查看wifimac,并copy
sn:查看sn码,并copy
activity:实时输出logcat日志到指定地方,然后在终端命令行中打开
screenshot:截屏并拉取,然后删除设备上的截屏文件
lct:打印日志详细时间的简单数据
lcc:清空日志信息
amc:关闭xxx程序
ams:启动xxx程序
reb:重启设备
uisc:卸载package
apc:拉取目录
scr25:开启录屏40秒,等待46秒,拉取a1.mp4这个文件到电脑目录下,删除设备上a1.mp4这个文件