测试机互相拆借,过多的应用占用手机空间,使用脚本将不需要的第三方应用卸载。
#!/bin/sh
#白名单
whiteName=(
com.tencent.mobileqq
com.tencent.mm
com.sina.weibo
com.tencent.mtt
com.alibaba.android.rimet
com.eg.android.AlipayGphone
com.UCMobile
com.alibaba.android.security.activity
)
for i in `adb devices|grep -w device|awk ‘{print $1}‘`;do
adb -s $i shell pm list packages -3|awk -F ‘:‘ ‘{print $2}‘ > ${i}.txt
#去除多余的\r
cat $i.txt|tr -d ‘\r‘ > ${i}_1.txt
for j in `cat ${i}_1.txt`;do
#判断该值是否在白名单中
if [[ "${whiteName[@]}" =~ $j ]];then
echo pass
else
echo $j
adb -s $i uninstall $j
fi
done
done