Last active
August 23, 2016 08:18
-
-
Save umarniz/0d2ea9a89de85cd8fceda20a080701ca to your computer and use it in GitHub Desktop.
Uninstalls package from all connected devices with pretty print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PACKAGE_TO_REMOVE="nl.sense_os."; | |
# Remove all apps with $PACKAGE_TO_REMOVE ids | |
echo "Started to loop over the connected android devices" | |
echo "" | |
for SERIAL in $(adb devices | grep -v List | cut -f 1); | |
do | |
deviceProps=`adb -s $SERIAL shell getprop ro.product.model`; | |
model=`echo $deviceProps`; | |
echo "Uninstalling following packages from device $model"; | |
adb -s $SERIAL shell pm list packages | grep $PACKAGE_TO_REMOVE | xargs -L 1 echo "---"; | |
adb -s $SERIAL shell pm list packages | grep $PACKAGE_TO_REMOVE | cut -f 2 -d : | perl -pe 's/\r//' | xargs -L 1 -n 1 adb -s $SERIAL uninstall | xargs -L 1 echo "-----"; | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment