zsh-users
 help / color / mirror / code / Atom feed
* how do I find my IP address?
@ 2004-06-14  0:57 Timothy Luoma
  2004-06-14  4:13 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy Luoma @ 2004-06-14  0:57 UTC (permalink / raw)
  To: Zsh Users


This may seem like a dumb question, but how can I get my computer's IP
address (I want to put it in my $PROMPT but I can't even figure out how to
get it from the commandline)


Sent using the Microsoft Entourage 2004 for Mac Test Drive.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how do I find my IP address?
  2004-06-14  0:57 how do I find my IP address? Timothy Luoma
@ 2004-06-14  4:13 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2004-06-14  4:13 UTC (permalink / raw)
  To: Zsh Users

On Sun, 13 Jun 2004, Timothy Luoma wrote:

> This may seem like a dumb question, but how can I get my computer's IP

There are a number of possibilities.  If $HOST is set to a FQDN, the
simplest might be

	$(dig +short $HOST 2>/dev/null)
or
	${$(host $HOST 2>/dev/null)[-1]}
or
	${$(nslookup $HOST 2>/dev/null)[-1]}

If $HOST is not set properly, try $(hostname -f) or $(hostname --long).

If all else fails:

    ${${${(M)=${(f)"$(telnet $HOST </dev/null 2>&1)"}:#Trying*}[2]}%...*}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-14  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-14  0:57 how do I find my IP address? Timothy Luoma
2004-06-14  4:13 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).