[Linux] Android Multi-Select apk installer & uninstaller

#!/bin/bash
#~/bin/apkuninstaller
# if you have more than one devices, 
# use adbs="adb -s $devce_numberno" to specify it
adbs=adb
#1. get the app list form device
i=0;
for list in `$adbs shell ls -1 /data/data/`
do 
    apklist[$i]=$list;
    ((i++));
done
#2. echo the app list to user select
for (( i = 0; i < ${#apklist[@]}; i++ )); do
    n=$[$i+1]
    printf "%3d)" $n
    echo " ${apklist[$i]}"
done
#3. choices and uninstall app
uninstall(){
    for n in $@; do 
        echo " Uninstall ${apklist[$[$n-1]]} "
        $adbs uninstall ${apklist[$[$n-1]]}
    done
}
read -p ">>What apps you want to uninstall?[Multi-select]: " uninstallList 
uninstall $uninstallList

 

#!/bin/bash
#~/bin/apkunstaller
for n in $@ ; 
    do echo "Install $n.." 
adb install $n done

 

你可能感兴趣的:(android)