Check for IP address at hotspot
uriel1998 Oct 24th, 2011 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #Sometimes when I've hooked up to a hotspot, before the "login" I'll get a bunch of crap
- #instead of an actual IP address in my conky config. This fixes that.
- #check for ip address
- ext_ip=$(wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]|.]//g')
- #check the length of the returned string.
- if [ $len_ext_ip -gt 16 ]; then
- # more than 16 digits, it's garbage; we're not connected.
- echo "0.0.0.0"
- # return the actual ip address.
- echo "$ext_ip"
RAW Paste Data