[OT] elegance? Thanks!

Willem Oldeman blfs at king-pin.nl
Wed Jan 1 12:31:32 PST 2003


Thanks Gareth,
your last solution seems to suit me best, since I get easy access to the 
netmask as well. Never thought of the dhcpcd info files....
The eval & grep work much better!
I use it to configure my firewalling rules on that good ole 486-66 :-)
Next time I'll direct this type of question to the blfs list. Sorry for that.

On Wednesday 01 January 2003 19:26, Gareth Jones wrote:
> > To fetch the dynamically assigned IP address from my interface I use the
> > following:
> >
> > ifconfig eth0 | grep "inet addr" | gawk -F" " '{ print $2 }' | gawk -F":"
> > '{ print $2 }'
>
> If your dhcpcd saves information to /var/lib/dhcpc/dhcpcd-eth0.info:
>
> grep IPADDR /var/lib/dhcpc/dhcpcd-eth0.info | sed s/IPADDR=//
>
> Or if you want it in a variable:
>
> eval $(grep IPADDR /var/lib/dhcpc/dhcpcd-eth0.info)
> echo $IPADDR
>
> BTW: This question is better suited to blfs-support.

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message



More information about the lfs-support mailing list