Created
January 16, 2024 18:22
-
-
Save Lerie82/5e92e39dd7433bfffa84c4de86480909 to your computer and use it in GitHub Desktop.
get the first attached device from the `adb devices -l` list
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
#!/usr/bin/env bash | |
#Lerie Taylor | |
#get the first device | |
first_dev=$(adb devices|head -n2|tail -1|sed -r 's/(.+)\t.+/\1/g') | |
if [ -z "$first_dev" ] | |
then | |
echo "No devices found" | |
exit 0 | |
fi | |
echo $first_dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment