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

Re: how do I find my IP address?



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]}%...*}



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