Created
September 3, 2019 21:55
-
-
Save NotWoods/65939d554888420594cd344a1ec02b35 to your computer and use it in GitHub Desktop.
Run ADB command on all connected devices
This file contains hidden or 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
# Use `source adb-all.sh` to get the adb-all command in the shell | |
# Run adb command on all connected devices | |
function adb-all() { | |
# adb devices -l: Print all devices, along with connected ports. Works with devices missing a serial no. | |
# egrep '(device|emulator) usb': Select lines with devices listed. (ex: SERIAL device usb:2-1.4.6) | |
# awk '{print $3}': Select the third item in the line, seperated by whitespace | |
# xargs ...: Run adb for each line piped in | |
adb devices -l | egrep '(device|emulator) usb' | awk '{print $3}' | xargs -t -I% -n1 -P5 \ | |
adb -s % "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment