Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #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.
- len_ext_ip=${#ext_ip}
- if [ $len_ext_ip -gt 16 ]; then
- # more than 16 digits, it's garbage; we're not connected.
- echo "0.0.0.0"
- else
- # return the actual ip address.
- echo "$ext_ip"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement