Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2003 21:30:22 -0800
From:      Michael Collette <metrol@metrol.net>
To:        David Banning <david@skytrackercanada.com>
Cc:        FreeBSD Mailing Lists <freebsd-questions@FreeBSD.org>
Subject:   Re: identifying my network address
Message-ID:  <200303092130.22748.metrol@metrol.net>

next in thread | raw e-mail | index | archive | help
David Banning wrote:

> I am running an Xwindow on a windows box. I need a script to
> tell me what my network address is so that I can set my DISPLAY
> varible correctly eg: 192.168.1.2:0.0
> 
> Any idea what command would be useful for this purpose?

It's ugly.  It won't work if you multiple NICs.  It may just work for what you 
need just the same.

echo `ifconfig | grep broadcast | cut -d" " -f2`":0.0"

This takes the output of ifconfig and parses it just a wee bit with grep and 
cut.  I use something very similar to this in a script that changes my 
network settings for my laptop on the fly.

Let me know if this works for ya.

Later on,
-- 
"Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark 
to read."
 - Groucho Marx

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303092130.22748.metrol>