Utility to get IP address of the machine
Bernhard Ege
bernhard@ege.cc
Thu Jan 5 13:39:00 GMT 2006
Andrew DeFaria wrote:
> Dave Korn wrote:
>
>>> Why not the more simple:
>>>
>>> ipconfig | grep "IP Address" | awk '{print $NF}'
>>
>>
>> Because that may return more than one result. And it doesn't choose
>> the one with the lowest metric, which is most likely to be the primary
>> gateway to the world-at-large.
>
>
> By and large most people have but 1 IP address but if you must tack on a
> "| head -1". YMMV
Perhaps, but if you ever use VPN, you have more than one network
interface (one physical and one virtual). This was why I created my
little script.
Also, many new motherboard have 2 NICs and also a firewire port that
also functions as a NIC. All in all, more than 1 network interface is
not that uncommon (I have 4 on my pc but up to 3 on my laptop (NIC,
wireless, VPN).
Anyway, I gave my script to aid, not to start a discussion.
Have fun ;-)
Bernhard
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list