Created
April 29, 2017 11:57
-
-
Save strooooke/f814542f5d6d89a82abefc3663c83a3c to your computer and use it in GitHub Desktop.
Wrapper script for adb commands (and pidcat!) that take a -s device serial argument, allowing to choose between devices
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
#!/bin/bash | |
# Prompts for device to use from adb devices -l first; inserts -s parameter. | |
# No sanitizing, error checking or warranties! | |
# Use like | |
# $choose_device adb shell | |
DEVICES=`adb devices -l | sed 1d` | |
PS3="Choose device or Ctrl+C to quit: " | |
IFS=$'\n' | |
select DEVICE in $DEVICES; | |
do | |
unset IFS | |
read -r DEVICE_ID _ <<< "$DEVICE" | |
ADB_CMD="$1" | |
shift | |
eval "$ADB_CMD -s $DEVICE_ID $@" | |
break | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment