Check IP shell script

Started by littleman, May 28, 2011, 02:05:06 AM

Previous topic - Next topic

littleman

Being a paranoid type I like to change my IP around a lot.  Fortunately I'm on a dynamic setup so getting a new IP is as simple as restarting the DSL modem.  I find it more convenient to call a script to check my IP than to use a web browser, so I use this script


#!/bin/bash
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
exit 0


Just save the script say as "myip.sh", and then do a "chmod +x myip.sh" to make it executable.  Then just call it by typing "./myip.sh" if you save it in your home directory.  Alternatively, you could save it in /usr/bin, or /usr/local/bin/ and then just call it as "myip.sh" in a term window.