Heinrisch Heinrisch - 3 months ago 24
Android Question

Running adb commands on all connected devices

Is there a way of running adb commands on all connected devices? To uninstall an app from all connected devices with "adb uninstall com.example.android".

The commands I am interested in is mainly install and uninstall.

I was thinking about writing a bash script for this, but I feel like someone should have done it already :)

Answer

Create a bash (adb+)

adb devices | while read line
do
    if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
    then
        device=`echo $line | awk '{print $1}'`
        echo "$device $@ ..."
        adb -s $device $@
    fi
done

use it with

adb+ //+ command