Created
August 6, 2012 08:49
-
-
Save ncornette/3272344 to your computer and use it in GitHub Desktop.
An interactive Bash function that allow you to select an Android device in a list then Sets ANDROID_SERIAL
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
# Display a list of all connected Android devices | |
# Set ANDROID_SERIAL environment from selected item | |
# Example of use : # adb-setdev && adb install -r myapp.apk | |
function adb-setdev() | |
{ | |
devices=($(adb devices|grep "device$"|cut -f1)) | |
devices_count=${#devices[*]} | |
if [ "$devices_count" -eq "0" ] | |
then | |
unset ANDROID_SERIAL | |
elif [ "$devices_count" -eq "1" ] | |
then | |
export ANDROID_SERIAL=$devices | |
else | |
# Ask for a device to select | |
select device in ${devices[*]} | |
do | |
export ANDROID_SERIAL=$device | |
break | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment