Код: Выделить всё
#!/bin/bash
if [[ -z $1 ]]
then
echo "Enter file name for list of packages to purge"
read PurgeFile
else
PurgeFile=$1
fi
LINE=1
while read -r CURRENT_LINE
do
if [[ $CURRENT_LINE != "" ]]
then
echo "attempting to remove: $LINE: $CURRENT_LINE"
#note, Next line causes the loop to exit if not commented out
adb shell pm uninstall --user 0 $CURRENT_LINE || true
fi
echo "Made it here"
((LINE++))
echo "Made it to outer loop"
done < $PurgeFile
Код: Выделить всё
$ bash Android_Purge_Script.sh Purge_Packages.txt
attempting to remove: 1: android.autoinstalls.config.samsung
Success
Made it here
Made it to outer loop
< /code>
Вот пинтаута из выполнения, где первый вызов ADB ' - это сбой, но где остальная часть списка в файле должна быть успешной: < /p>
bash Android_Purge_Script.sh Purge_Packages.txt
attempting to remove: 1: android.autoinstalls.config.samsung
Failure [not installed for 0]
Made it here
Made it to outer loop
Код: Выделить всё
attempting to remove: 1: android.autoinstalls.config.samsung
Made it here
Made it to outer loop
attempting to remove: 2: com.amazon.appmanager
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 4: com.android.apps.tag
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 6: com.android.bips
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 8: com.android.bluetoothmidiservice
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 10: com.android.bookmarkprovider
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 12: com.android.calllogbackup
Made it here
Made it to outer loop
Made it here
Made it to outer loop
attempting to remove: 14: com.android.chrome
Подробнее здесь: https://stackoverflow.com/questions/797 ... al-command
Мобильная версия