Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: how do I find my IP address



On 6/13/04 9:30 PM, "William Scott" <wgscott@xxxxxxxxxxxxxxxxxx> wrote:

> If you are running a computer with an ip address that changes
> (dynamically allocated), this will work, although it is kind of ugly:
> 
> define an alias such as:
> 
> alias myip="curl -s http://www.showmyip.com/simple/ | awk '{print $1}'
> "

Ah, no good.  This shows my public IP address (the official internet IP
given to me by my ISP when I am dialed up).

[My apologies for being too vague.  I hope I haven't wasted anyone's time]

> If you have a static ip address, you should only have to figure this
> out once. 

I'm actually on two private LANs (one home and one work)... home uses
10.x.x.x and work uses 192.168.x.x but they are both given out via DHCP.


Right now the ugly hack I have is this:

    ifconfig en1 | fgrep 'inet ' | awk '{print $2}'

which works for the Mac, but it would have to be

    ifconfig eth0 | fgrep 'inet ' | awk '{print $2}' |\
    sed 's/addr://'

on Fedora, and possibly even something ELSE for FreeBSD.  Obviously less
than ideal to have to keep hacking several different ways of doing this, but
if that's the only way...


> On Mac OS X you can find this in the System Preferences
> under file sharing or network settings (I am assuming this on the basis
> of the Micro$oft email stamp at the bottom of your email.)

Ah yes, sorry about that.  I saved about $340USD by waiting for Office:2004
to hit the Microsoft employee store, so I've been using the demo version
while waiting.  I should have an official copy soon (aside: I've never liked
Word or Office but Office:Mac 2004 is quite nice).

[no, I'm not an MS employee, but a friend of mine is]

Anyway, I'm running zsh on Fedora, FreeBSD, and Mac OSX. (I actually just
got my old Dell 7500 setup to dual boot XP/Fedora/FreeBSD today, which is
what prompted the question.  I'm all of a sudden going to need/want to know
several bits of information which I haven't needed to know before.

The real challenge is going to be to see if I can write one .zshrc which I
can use on all my difference zsh shell accounts by use of conditional
statements.

> This alias and a whole bunch of stuff that is useful for OS X zsh is
> distributed by Gary Kerbaugh.  I have links to it and a few of my own
> zsh functions here:  http://tinyurl.com/3373b

Cool, will check it out.

Thanks

TjL

Sent using the Microsoft Entourage 2004 for Mac Test Drive.




Messages sorted by: Reverse Date, Date, Thread, Author