-
-
Save wwwtete/a48ad0b496eae8e6b8a6c1e092fbb97d to your computer and use it in GitHub Desktop.
A bash script that let's you issue adb commands to multiple devices at once
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 | |
# Script adb+ | |
# Usage | |
# You can run any command adb provides on all your currently connected devices | |
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command> | |
# | |
# Examples | |
# ./adb+ version | |
# ./adb+ install apidemo.apk | |
# ./adb+ uninstall com.example.android.apis | |
# 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 | |
# This command works perfect | |
# adb devices | awk 'NR>1{print $1}' | xargs -n1 -I% adb -s % install foo.apk | |
for line in `adb devices | grep -v "List" | awk '{print $1}'` | |
do | |
device=`echo $line | awk '{print $1}'` | |
echo "$device $@ ..." | |
adb -s $device $@ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment