Last active
December 5, 2016 15:44
-
-
Save schlan/559419576e634ba74d33 to your computer and use it in GitHub Desktop.
Send adb commands to all connected devices
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 | |
if [ "$#" -lt 1 ] | |
then | |
echo "No arguments given" | |
exit | |
fi | |
ADB="adb" | |
ARGS="$@" | |
echo | |
$ADB devices -l | sed '1d;$d' | while read device | |
do | |
PRODUCT=`sed "s/^.*\(product\:[^\\ ]*\).*$/\1/g" <<< $device | cut -d ':' -f2` | |
MODEL=`sed "s/^.*\(model\:[^\\ ]*\).*$/\1/g" <<< $device | cut -d ':' -f2` | |
echo "==== " $PRODUCT / $MODEL " ====" | |
ID=`cut -d ' ' -f1 <<< $device` | |
$ADB -s $ID $ARGS | |
echo | |
done |
Author
schlan
commented
Jan 7, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment