Skip to content

Instantly share code, notes, and snippets.

@Lerie82
Created January 16, 2024 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lerie82/5e92e39dd7433bfffa84c4de86480909 to your computer and use it in GitHub Desktop.
Save Lerie82/5e92e39dd7433bfffa84c4de86480909 to your computer and use it in GitHub Desktop.
get the first attached device from the `adb devices -l` list
#!/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