Last active
January 13, 2017 12:46
-
-
Save jasonrogena/28867d7fe19570000b8eab97d62bdd15 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
echo "Enter the serial number for the device you want to switch to WiFi" | |
read serialNo | |
ipAddr=`adb -s ${serialNo} shell ifconfig wlan0 | sed -n 's/inet addr:\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p'` | |
if [ -z "${ipAddr}" ]; then | |
ipAddr=`adb -s ${serialNo} shell netcfg | sed -n 's/wlan0[ ]*UP[ ]*\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p'` | |
fi | |
echo "IP Addres is "${ipAddr} | |
adb -s ${serialNo} tcpip 5555 | |
adb connect ${ipAddr}:5555 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment