Skip to content

Instantly share code, notes, and snippets.

@atoennis
Last active August 29, 2015 14:17
Show Gist options
  • Save atoennis/8363b28792751ec404bc to your computer and use it in GitHub Desktop.
Save atoennis/8363b28792751ec404bc to your computer and use it in GitHub Desktop.
Run any command adb provides on all your currently connected devices. Credit: http://stackoverflow.com/a/17882578
#!/bin/bash
# Script adb+
# Usage
# You can run any command adb provides on all your currently connected devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
adb devices | while read line
do
  if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
  then
      device=`echo $line | awk '{print $1}'`
      echo "adb -s $device $@ ..."
      adb -s $device $@
  fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment