Skip to content

Instantly share code, notes, and snippets.

@samdfonseca
Created June 4, 2015 23:01
Show Gist options
  • Save samdfonseca/f5fa04a01cd69c77c923 to your computer and use it in GitHub Desktop.
Save samdfonseca/f5fa04a01cd69c77c923 to your computer and use it in GitHub Desktop.
Make adb easier with multiple devices
#!/bin/sh
_adbd () {
if [ "$1" ]
then
devices=(${=$(_adbdevices $1)})
if [ "$devices[2]" ]
then
echo "Matched multiple devices. Please specify search."
for device in $devices
do
echo $device | colout $1 red bold
done
else
if [ "$@[2]" ]
then
adb -s "$devices[1]" "$@[2,-1]"
else
adb
fi
fi
else
adb devices
fi
}
alias adbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment