因频繁需要批量安装很多应用,所以写了个shell脚本。
所有apk安装包都在/temp/apks下,代码如下:
说明:
apkDir:配置放置apk文件的目录
然后直接执行脚本:./installApks.sh
#! /bin/bash
#installApks.sh
echo '============= start install apk ============='
apkDir="/temp/apks"
path=""
subDir=""
cd $apkDir
function readDir(){
cd $apkDir
filelist=`ls $1`
for file in $filelist
do
# echo $file
installApk $file
done
}
function installApk(){
file=$1
extension="${file##*.}"
if [ "$extension" = "apk" ]
then
echo "install "$file" ..."
adb install $file
else
echo "Error:"$file "is not apk file."
fi
}
readDir $apkDir