On Tue, Jun 28, 2005 at 05:05:28PM -0400, Douglas Ward wrote:
> > ifconfig | grep -1 ppp0 | tail -1 | sed 's/.*r://' | sed 's/ .*$//'
> > Replace ppp0 with your active interface.
> And,
> ifconfig eth0 | grep inet | awk '{print $2}' | awk -F : '{print $2}'
I believe he was looking for his external IP, not his local
DHCP IP. ifconfig will not tell you your external IP. For
that, you need to do something (mildly) more sophisticated,
like requesting a web page on a remote site that will tell
you the IP which made the request. Here's a tiny script that
will do it:
#!/bin/bash
wget -O - http://whatismyip.org/ 2>/dev/null
--
Stephen R. Laniel
steve@laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
Attachment:
signature.asc
Description: Digital signature