Created
March 21, 2015 16:30
-
-
Save manadream/b3d4ee1710d956d34f00 to your computer and use it in GitHub Desktop.
Bash Script for connecting to and parsing android devices over adb
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
getDevices () { | |
DEVICES=($(adb devices | grep "device$" | sed -e "s|device||g")) | |
for i in {1..9} | |
do | |
FOUND=0 | |
for j in ${DEVICES[@]} | |
do | |
if [ "$j" == "192.168.56.10${i}:5555" ] | |
then | |
FOUND=1 | |
fi | |
done | |
if [ ${FOUND} -eq 0 ] | |
then | |
adb disconnect 192.168.56.10${i} | |
adb connect 192.168.56.10${i} | |
fi | |
done | |
DEVICES=($(adb devices | grep "device$" | sed -e "s|device||g")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment