Re: check my own ip number ?
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: Wed, 16 Nov 2005 23:31:26 -0500
On 2005-11-16, Dan Mercer wrote:
> "Thomas Bosch" <email@example.com> wrote in message news:firstname.lastname@example.org...
>: lynx -dump http://checkip.dyndns.org|cut -d ":" -f 2|sed -e 's/|head -n 1
> None of these web based solutions will work if you are behind a NAT router/firewall.
> Now that may be the IP you are looking for, though it's unlikely you'll be able
> to do much with it.
Many of the questions I see are looking for exactly that IP
address. Many are looking for the lan address. That's why I wrote
this script that gets whichever one you want:
## USAGE: ipaddr [-n]
if [ "$1" = "-n" ]
ip=$(lynx -dump http://cfaj.freeshell.org/ipaddr.cgi)
case $system in
FreeBSD) sep="inet " ;;
Linux) sep="addr:" ;;
*) echo "System not supported: $system"; exit 1;;
printf "%s\n" "$ip"
> What - no perl on your system?
-- Chris F.A. Johnson, author | <http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Solution Approach | is released under the 2005, Apress | GNU General Public Licence