Skip to content

Instantly share code, notes, and snippets.

@GianpaMX
Last active March 29, 2022 10:48
Show Gist options
  • Save GianpaMX/1604acc05282d5bc23a2eb53228bdbb2 to your computer and use it in GitHub Desktop.
Save GianpaMX/1604acc05282d5bc23a2eb53228bdbb2 to your computer and use it in GitHub Desktop.
Prints phone ip address
#!/bin/bash
adb() {
if [[ $@ == "ip" ]]; then
command adb shell netcfg | grep wlan0 | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
else
command adb "$@"
fi
}
@GianpaMX
Copy link
Author

Add

source ~/.adb-ip-address.sh

To ~/.profile file

Then the output would be

~ $ adb ip
10.102.131.80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment