Skip to content

Instantly share code, notes, and snippets.

@tzutalin
Created November 1, 2017 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzutalin/06aa847782a7299cb86409dbf485a712 to your computer and use it in GitHub Desktop.
Save tzutalin/06aa847782a7299cb86409dbf485a712 to your computer and use it in GitHub Desktop.
Android Scripts
#!/bin/sh
# Author : tzu.ta.lin@gmail.com
# Copyright [2015] <tzu.ta.lin@gmail.com>
PORT=5555
if [ $# -ne 0 ]; then
while [ $# != 0 ]
do
PORT=$1
shift
done
fi
echo "Ask ADB to listen to Port $PORT"
adb tcpip $PORT
adb wait-for-device
device_ip=$(adb shell netcfg | egrep -i 'wlan' | awk -F' ' '{print $3}' | awk -F'/' '{print $1}')
echo "Android device IP is $device_ip"
echo "$device_ip:$PORT"
adb connect "$device_ip:$PORT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment