Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: how do I find my IP address?
- X-seq: zsh-users 7537
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: how do I find my IP address?
- Date: Sun, 13 Jun 2004 21:13:03 -0700 (PDT)
- In-reply-to: <BCF27033.2268%lists@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: Zsh Users <zsh-users@xxxxxxxxxx>
- Sender: schaefer@xxxxxxxxxxxxxxxxxx
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