Ich möchte eine Reihe von Apps auf einem Android-Gerät löschen, die alle mit demselben Paket beginnen. Ich erhalte diese mit folgendem Befehl:
$ adb shell ls /data/data | grep -i com.company
com.company.android.app.adwidget
com.company.android.app.attendancereports
com.company.android.app.atteventmanagement
com.company.android.app.buttonwidget
com.company.android.app.clockwidget
Jetzt möchte ich adb uninstallfür jeden dieser Paketnamen Folgendes ausführen xargs: Ich dachte daran, Folgendes zu verwenden :
$ adb shell ls /data/data | grep -i com.company | xargs -n1 echo adb uninstall
adb uninstall com.company.android.app.adwidget
adb uninstall com.company.android.app.attendancereports
adb uninstall com.company.android.app.atteventmanagement
adb uninstall com.company.android.app.buttonwidget
adb uninstall com.company.android.app.clockwidget
Es sieht so aus, als würde es funktionieren, also entferne ich echo:
$ adb shell ls /data/data | grep -i com.company | xargs -n1 adb uninstall
Failure
Failure
Failure
Failure
Failure
Wenn Sie jedoch jeden Befehl unabhängig ausführen, erhalten Sie Success:
$ adb uninstall com.company.android.app.adwidget
Success
Was mache ich falsch?
adb shell ls, nicht adb ls, macht das einen Unterschied machen?
/data/data/somethingstatt sein something.
no matches found. Das Zitieren verhält sich genauso wie in meiner Frage ( Failurefür alle Hinrichtungen)
grep, verwenden Sie einfach einen Globus:adb ls /data/data/*com.company* | xargs -n1 adb uninstallsollten Sie das Gleiche tun. Funktioniert es, wenn Sie es tunfor i in adb ls /data/data/*com.company*; do adb uninstall "$i"; done?