delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/07/17:53:16

From: luc DOT tanguay AT Bell DOT ca (TANGUAY, LUC)
Subject: Re: Finding Out My Own IP-Address
7 May 1998 17:53:16 -0700 :
Message-ID: <3551B6FA.2A34DCEA.cygnus.gnu-win32@bell.ca>
References: <199805062058 DOT NAA06618 AT cygnus DOT com>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

I have a bash script to do it (it's called getIPaddress :-)

#!/bin/bash
# Get the IP address of the first LAN adapter.
/winnt/system32/ipconfig | grep "IP Address" | head -1 | sed 's/^.*: //'

Example of its use:

--- start of example ---
#!/bin/bash
export DISPLAY=$($HOME/bin/getIPaddress):0.0
# If network not started, address will be nul.  So correct it.
if [ "$DISPLAY" = "0.0.0.0:0.0" ]
then
	export DISPLAY=localhost:0.0
fi
--- end of example ---

Hope this help, Luc.
-- 
Luc Tanguay, ing.
Bell Canada
Recherche et génie logiciel/Software Engineering & Research
1050 Beaver Hall, 2e étage/2nd floor
Montréal (Québec) H2Z 1S4, Canada
Tél./phone: (514) 786-6440
mailto:Luc DOT Tanguay AT bell DOT ca
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019