Re: [gentoo-user] file with IP?

2005-11-04 Thread Nick Rout
On Thu, 03 Nov 2005 09:15:20 + Neil Bothwick [EMAIL PROTECTED] wrote: On Thu, 03 Nov 2005 07:56:08 +0800, William Kenworthy wrote: doesnt work well. In my case only gives one lan IP, misses the other Lan and the dhcp ADSL IP. Not a lot of use :( No, but on a box with a single IP

Re: [gentoo-user] file with IP?

2005-11-04 Thread Neil Bothwick
On Fri, 4 Nov 2005 21:22:40 +1300, Nick Rout wrote: No, but on a box with a single IP address, it makes life a lot easier. on my box (1 ethernet and loopback up and one wireless down) it gives 127.0.0.1 Seems a bit hit and miss. I've just tried it on four machines, one of them returned

Re: [gentoo-user] file with IP?

2005-11-04 Thread brullo nulla
Given this hell, I can't see why my original suggestion of parsing ifconfig has not been taken into account... a couple of lines of python/perl/whatever should do the trick. m. -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-04 Thread Neil Bothwick
On Fri, 4 Nov 2005 16:12:07 +0100, brullo nulla wrote: Given this hell, I can't see why my original suggestion of parsing ifconfig has not been taken into account... a couple of lines of python/perl/whatever should do the trick. Given the apparent vagaries of hostname -i, I'm inclined to

Re: [gentoo-user] file with IP?

2005-11-04 Thread Jorge Almeida
On Fri, 4 Nov 2005, brullo nulla wrote: Given this hell, I can't see why my original suggestion of parsing ifconfig has not been taken into account... a couple of lines of It has, at least by the OP (that would be me). /sbin/ifconfig|grep -m 1 inet|sed -e 's/^\s*inet addr://'|sed -e

Re: [gentoo-user] file with IP?

2005-11-04 Thread brullo nulla
Given this hell, I can't see why my original suggestion of parsing ifconfig has not been taken into account... a couple of lines of It has, at least by the OP (that would be me). /sbin/ifconfig|grep -m 1 inet|sed -e 's/^\s*inet addr://'|sed -e 's/\s.*$//' Wow. You evil geniuses of

Re: [gentoo-user] file with IP?

2005-11-04 Thread Billy Holmes
brullo nulla wrote: Wow. You evil geniuses of regular expressions! °_° can even shorten it with just one sed expression: /sbin/ifconfig eth0 | sed -n 's/^.*inet addr:\([^ ]*\) .*$/\1/p' -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-04 Thread Alexander Skwar
Billy Holmes schrieb: brullo nulla wrote: Wow. You evil geniuses of regular expressions! °_° can even shorten it with just one sed expression: /sbin/ifconfig eth0 | sed -n 's/^.*inet addr:\([^ ]*\) .*$/\1/p' Doesn't work, as it makes wrong assumptions. It assumes, that there's string inet

Re: [gentoo-user] file with IP?

2005-11-04 Thread Arturo 'Buanzo' Busleiman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What about ip addr show dev eth0 | awk '{print $2}' | grep -v \: | head -n 1 | cut -d'/' -f1 - -- Arturo Buanzo Busleiman - www.buanzo.com.ar Consultor en Seguridad Informatica KTP Consultores - info AT ktpconsultores.com.ar Romper un sistema de

Re: [gentoo-user] file with IP?

2005-11-04 Thread Billy Holmes
Alexander Skwar wrote: But I actually don't quite like the regexp - it's too long... With perl, I'd use a non-gready .*, like so: then don't use a regex at all: /sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d ' ' -f 1 -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-04 Thread Fredrik
ifconfig eth0 | awk 'NR==2 {print $2}' | sed -e s/addr:// will also work.(you may need to modify it so it fit your own cards) //Fredrik Billy Holmes wrote: Alexander Skwar wrote: But I actually don't quite like the regexp - it's too long... With perl, I'd use a non-gready .*, like so:

Re: [gentoo-user] file with IP?

2005-11-04 Thread Alexander Skwar
Arturo 'Buanzo' Busleiman schrieb: What about ip addr show dev eth0 | awk '{print $2}' | grep -v \: | head -n 1 | cut -d'/' -f1 IMO, too many different commands to be elegant... Further: [EMAIL PROTECTED] ~ $ ip addr show dev ra0 bash: ip: command not found But if awk is okay, I'd do:

Re: [gentoo-user] file with IP?

2005-11-04 Thread Alexander Skwar
Billy Holmes schrieb: Alexander Skwar wrote: But I actually don't quite like the regexp - it's too long... With perl, I'd use a non-gready .*, like so: then don't use a regex at all: /sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d ' ' -f 1 Don't like that - there might be

Re: [gentoo-user] file with IP?

2005-11-04 Thread Arturo 'Buanzo' Busleiman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alexander Skwar wrote: Arturo 'Buanzo' Busleiman schrieb: What about ip addr show dev eth0 | awk '{print $2}' | grep -v \: | head -n 1 | cut -d'/' -f1 IMO, too many different commands to be elegant... But simple. The idea of writing

Re: [gentoo-user] file with IP?

2005-11-04 Thread Billy Holmes
Alexander Skwar wrote: Don't like that - there might be locales, where there's no inet in the line. IMO better: /sbin/ifconfig eth0 | grep :255\. | cut -d : -f 2 | cut -d ' ' -f 1 broadcasts don't always begin or end with 255, odd yes, but if we're spliting hairs then anything is possible.

Re: [gentoo-user] file with IP?

2005-11-04 Thread Alexander Skwar
Billy Holmes schrieb: Alexander Skwar wrote: Don't like that - there might be locales, where there's no inet in the line. IMO better: /sbin/ifconfig eth0 | grep :255\. | cut -d : -f 2 | cut -d ' ' -f 1 broadcasts don't always begin or end with 255, odd yes, but if we're spliting hairs

Re: [gentoo-user] file with IP?

2005-11-03 Thread Neil Bothwick
On Thu, 03 Nov 2005 07:56:08 +0800, William Kenworthy wrote: doesnt work well. In my case only gives one lan IP, misses the other Lan and the dhcp ADSL IP. Not a lot of use :( No, but on a box with a single IP address, it makes life a lot easier. -- Neil Bothwick Being defeated is a

Re: [gentoo-user] file with IP?

2005-11-03 Thread Willie Wong
On Thu, Nov 03, 2005 at 09:15:20AM +, Neil Bothwick wrote: On Thu, 03 Nov 2005 07:56:08 +0800, William Kenworthy wrote: doesnt work well. In my case only gives one lan IP, misses the other Lan and the dhcp ADSL IP. Not a lot of use :( No, but on a box with a single IP address, it

Re: [gentoo-user] file with IP?

2005-11-03 Thread Neil Bothwick
On Thu, 3 Nov 2005 13:43:44 -0500, Willie Wong wrote: Maybe something is misconfigured on my box, but I get [01:41 PM]wwong ~ $ hostname -i 127.0.0.1 which is probably not very helpful =p (of course, this is on a static IP on a LAN, so it might be slightly different from what the

Re: [gentoo-user] file with IP?

2005-11-03 Thread Willie Wong
On Thu, Nov 03, 2005 at 07:10:48PM +, Neil Bothwick wrote: On Thu, 3 Nov 2005 13:43:44 -0500, Willie Wong wrote: Maybe something is misconfigured on my box, but I get [01:41 PM]wwong ~ $ hostname -i 127.0.0.1 which is probably not very helpful =p (of course, this is on

Re: [gentoo-user] file with IP?

2005-11-02 Thread John Jolet
On Wednesday 02 November 2005 09:04, Jorge Almeida wrote: Anyone knows whether the current (dynamical) IP is stored in some text file? I know I can find the IP with ifconfig, but if the value were stored in some file I could setup a service to monitor the file for changes and take appropriate

Re: [gentoo-user] file with IP?

2005-11-02 Thread Richard Fish
Jorge Almeida wrote: Anyone knows whether the current (dynamical) IP is stored in some text file? I know I can find the IP with ifconfig, but if the value were stored in some file I could setup a service to monitor the file for changes and take appropriate actions on change of IP. A simple

Re: [gentoo-user] file with IP?

2005-11-02 Thread tkhemili78
John Jolet wrote: On Wednesday 02 November 2005 09:04, Jorge Almeida wrote: Anyone knows whether the current (dynamical) IP is stored in some text file? I know I can find the IP with ifconfig, but if the value were stored in some file I could setup a service to monitor the file for changes

Re: [gentoo-user] file with IP?

2005-11-02 Thread brullo nulla
You can also poll the ip by doing an ifconfig and parsing its output inside your application. I think the overhead on the system would be barely recognizable if you do a reasonable (no more than every 5 seconds, let's say) poll. -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-02 Thread Jorge Almeida
On Wed, 2 Nov 2005, brullo nulla wrote: You can also poll the ip by doing an ifconfig and parsing its output inside your application. I think the overhead on the system would be barely recognizable if you do a reasonable (no more than every 5 seconds, let's say) poll. May be a good idea.

Re: [gentoo-user] file with IP?

2005-11-02 Thread Neil Bothwick
On Wed, 2 Nov 2005 16:53:11 +0100, brullo nulla wrote: You can also poll the ip by doing an ifconfig and parsing its output inside your application. I think the overhead on the system would be barely recognizable if you do a reasonable (no more than every 5 seconds, let's say) poll. Wouldn't

Re: [gentoo-user] file with IP?

2005-11-02 Thread b.n.
Wouldn't it be easier to use the output from hostname -i? It needs no parsing. But it doesn't give the IP of my box... m. -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-02 Thread Thomas T. Veldhouse
b.n. wrote: Wouldn't it be easier to use the output from hostname -i? It needs no parsing. But it doesn't give the IP of my box... Indeed, there are likely several. Tom Veldhouse -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] file with IP?

2005-11-02 Thread Hans-Werner Hilse
Hi, On Wed, 2 Nov 2005 18:54:06 + Neil Bothwick [EMAIL PROTECTED] wrote: On Wed, 2 Nov 2005 16:53:11 +0100, brullo nulla wrote: You can also poll the ip by doing an ifconfig and parsing its output inside your application. I think the overhead on the system would be barely

Re: [gentoo-user] file with IP?

2005-11-02 Thread William Kenworthy
doesnt work well. In my case only gives one lan IP, misses the other Lan and the dhcp ADSL IP. Not a lot of use :( On another box it misses the bluetooth LAN BillK On Wed, 2005-11-02 at 18:54 +, Neil Bothwick wrote: On Wed, 2 Nov 2005 16:53:11 +0100, brullo nulla wrote: You can also