Skip to content

Commit 6e9aee0

Browse files
committed
shell脚本
1 parent c1badfe commit 6e9aee0

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

shell/getApp.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
#获取设备当前应用,存放于app目录下
4+
5+
#获取设备当前应用的包名
6+
pkgname=`adb shell dumpsys window w | grep \/ | grep name= | cut -d = -f 3 | cut -d / -f 1`
7+
8+
#获取应用的apk路径
9+
pkgpath=`adb shell pm list packages -f $pkgname | cut -d : -f 2 | cut -d = -f 1`
10+
11+
#apk存放目录
12+
dir=app
13+
if [ ! -d "$dir" ]
14+
then
15+
mkdir $dir
16+
fi
17+
18+
#pull apk
19+
echo start pull $pkgname
20+
`adb pull $pkgpath $dir`
21+
echo Completed
22+

shell/getCurrentActivity.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
#获取设备当前应用的Activity,打印在控制台
4+
adb shell dumpsys window w | grep \/ | grep name= | cut -d = -f 3 | cut -d \) -f 1
5+
6+
#将结果写入currentActivity.txt文件中
7+
#adb shell dumpsys window w | grep \/ | grep name= | cut -d = -f 3 | cut -d \) -f 1 > currentActivity.txt

0 commit comments

Comments
 (0)