Could someone tell me how to assign a DHCP IP address to a variable? I
have a command that extracts the DHCP IP address but I can't assign the
results to a variable. Here is the command:
ifconfig eth0 | grep " addr:" | cut -d ":" -f2 | cut -f1 -d " "
I need to assign the results of the command above to a variable.
Preferrably DHCP_IP.
I've tried DHCP_IP=<command> but that doesn't work.
Any help will be greatly appreciated.