Tuesday, July 31, 2012

What's My IP Address?


Would you like to know your IP address for a script?  There are quite a few websites that will display your IP address, but when writing script for any sort of automation, you don't want to do a lot of screen-scraping.

Try this one:

http://automation.whatismyip.com/n09230945.asp

Regardless of what website you find that works, to grab the address in a bash script, use curl.  Something like this will do...

IP=`/usr/bin/curl -s http://automation.whatismyip.com/n09230945.asp`



No comments:

Post a Comment