[OT] elegance?

Gareth Jones moderob at lineone.net
Wed Jan 1 10:26:31 PST 2003


> 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.

-- 
Gareth
-- 
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