| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| X-T2-Posting-ID: | scpomQ6OoLdFPJaiveQ0Zw== |
| X-Cloudmark-Score: | 0.000000 [] |
| Message-ID: | <43BD212A.3060201@ege.cc> |
| Date: | Thu, 05 Jan 2006 14:37:46 +0100 |
| From: | Bernhard Ege <bernhard AT ege DOT cc> |
| User-Agent: | Mozilla Thunderbird 1.0.7 (Windows/20050923) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Utility to get IP address of the machine |
| References: | <dpffn5$tn9$1 AT sea DOT gmane DOT org> <SERRANOo6ogrIZib45Y000001dc AT SERRANO DOT CAM DOT ARTIMI DOT COM> <dpiqpt$fhc$1 AT sea DOT gmane DOT org> |
| In-Reply-To: | <dpiqpt$fhc$1@sea.gmane.org> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |