On Tue, Nov 27, 2001 at 03:34:50PM +0000, Timm Murray wrote:
< >
> > Writing _Linux_ scripts to do it would be fairly easy, it my
> > understanding that general unix methods of determining the local ip(s)
> > are lacking (which is why you'll often see scripts attempting to do it
> > in 4-5 different ways).
>
> I know the output of /sbin/ifconfig is basicly the same on all major
> GNU/Linux distros and
> OpenBSD (and probably all the other BSDs), so grepping and seding the output
> gives us
> a major chunk of deployed Unix systems. Any types of Unix that don't follow
> this
> convention can either set the IP manually or write their own scripts.
But grepping ifconfig for what? The only thing I can think of this the
horrible approach of taking out the known private networks, something
like:
/sbin/ifconfig | sed s/:/\ /g | awk '/inet\ addr/ && !/\ 192\.168\./ &&
!/\ 10\./ && !/\ 172\.((1[6-9])|(2[0-9])|(3[0-1]))/ && !/\ 127\./ {
print $3 }'
Maybe there is a better output mode...
<>
--
Oskar Sandberg
oskar at freenetproject.org
_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/devl