Shell脚本:
#!/bin/bash devices=( $(adb devices|grep device$|awk '{print $1}'|xargs echo) )case ${#devices[@]} in0 )echo "can't found a android device!";;1 )serial=$devices;;* )select serial in ${devices[@]}; dobreak;done;; esacif [[ -z $serial ]]; thenecho "Not select a android device, exit not"exit 1 fiadb -s $serial shell echo OK