#!/usr/bin/env bash ARGS=($*) ADB="adb" ANDROID_DEVICES=(`adb devices | sed '1d' | awk '{print $1}'`) if [[ ${#ANDROID_DEVICES[@]} -gt 1 ]];then for((j=0;j<${#ANDROID_DEVICES[@]};j++)) do echo $(expr ${j} + 1).${ANDROID_DEVICES[$j]} done while [[ $REPLY == "" || $REPLY == "0" ]];do read -p "输入序号选择设备:" done ADB="adb -s "${ANDROID_DEVICES[$REPLY-1]} fi ${ADB} ${ARGS[@]}
|