On Fri, 2009-02-13 at 15:51 +0000, Paul Mcdaid wrote:
> IP_ADDR=`ifconfig eth0 | grep 'inet ' | cut -d : -f 2 | cut -d ' ' -f 1`
> IP_MASK=`ifconfig eth0 | grep 'inet ' | cut -d : -f 4`

Using 'cut' is kind of vulnerable to formatting changes, though.  I'd
use something like this Perl code:

if (/\sinet addr:([0-9.]+(\s.*\smask:([0-9.]+)/i) {
    $ip_addr = $1;
    $ip_addr = $2;
}

That recognizes the values based on how they're labeled, which is likely
to be much more stable between versions.

Dale


_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev

Reply via email to