Created
May 9, 2018 13:49
-
-
Save mcrisc/9761db53fe5368b03a157b2ceb794f9f to your computer and use it in GitHub Desktop.
Uninstall Android applications via ADB
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/bash | |
ADB="$ANDROID_HOME/platform-tools/adb" | |
if [ -z "$1" ]; then | |
echo "usage: $0 <filter> [rm]" | |
exit 1 | |
fi | |
FILTER="$1" | |
CMD="$2" | |
for app in `$ADB shell pm list packages $FILTER | sed -e 's/package://' | tr -d '[\r\n]'`; | |
do | |
if [ "$CMD" == "rm" ]; then | |
CMDLINE="${ADB} shell pm uninstall ${app}" | |
echo $CMDLINE | |
eval $CMDLINE | |
else | |
echo "$app" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment