Created
January 12, 2021 07:43
-
-
Save syneart/3c6f03e40dba88dc367164b91b2c532f to your computer and use it in GitHub Desktop.
Revisions
-
syneart created this gist
Jan 12, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/bash # This shell script is made by SyneArt <[email protected]> # Android Studio default path on Mac adb=~/Library/Android/sdk/platform-tools/adb function connect() { device_id=$1 device_ip=`${adb} -s ${device_id} shell ip -f inet addr show wlan0 | grep -e "[0-9].*\/[0-9]*" | awk '{ print $2 }' | sed 's/\/[0-9]*//'` echo "Android device id: ${device_id}" ${adb} -s ${device_id} tcpip 5555 ${adb} connect ${device_ip} } while IFS= read -r line; do results_device_id+=("$line"); done < <(${adb} devices | grep -v "devices\|:" | grep "device\|offline" | cut -f 1) [[ "${#results_device_id[@]}" -eq "0" ]] && echo "No any android devices need to switch to WiFi debug mode!" for ((k=0; k<"${#results_device_id[@]}"; k++)) do connect ${results_device_id[$k]} done