Use
http://ifconfig.me/all/json
https://github.com/dominictarr/JSON.sh
#!/bin/bash # Grab external IP and copy to Dropbox or other remote locations. curl -s http://ifconfig.me/all/json | /home/seth/scripts/system/JSON.sh -b | grep -i "ip_addr" | cut -d " " -f 2 | cut -d "\"" -f 2 > /home/seth/Dropbox/track_data/$HOSTNAME.ip
Or you can use this.
lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g'
721 total views, 1 views today