| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| To: | cygwin AT cygwin DOT com |
| From: | Andrew DeFaria <Andrew AT DeFaria DOT com> |
| Subject: | Re: Utility to get IP address of the machine |
| Date: | Thu, 05 Jan 2006 02:01:32 -0800 |
| Lines: | 15 |
| Message-ID: | <dpiqpt$fhc$1@sea.gmane.org> |
| References: | <dpffn5$tn9$1 AT sea DOT gmane DOT org> <SERRANOo6ogrIZib45Y000001dc AT SERRANO DOT CAM DOT ARTIMI DOT COM> |
| Mime-Version: | 1.0 |
| User-Agent: | Mozilla Thunderbird 1.0.7 (Windows/20050923) |
| In-Reply-To: | <SERRANOo6ogrIZib45Y000001dc@SERRANO.CAM.ARTIMI.COM> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| 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 |
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
--
I had a dream that all the victims of The Pill came back...boy, were
they mad!!
--
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 |