very basic inquiry
I'm trying to extract information from my '/etc/resolv.conf' file for a firewall script. The interface will be assigned IP and DNS info via DHCP, and to keep things fairly strict, I want to have the IP and DNS info used in my firewall script. Here is what I've done so far (if someone has a better solution, please don't hesitate to correct me!;)):
Code:
ifconfig |grep eth0 -C 1|grep inet|cut -d ':' -f 2|cut -d ' ' -f 1 > IIP The other thing is that this method saves the info to a file (due to the '>'). What if I just want a variable in the firewall script to be assigned the information? |
I use this in my firewall script to do the same:
Code:
ifconfig eth0 | sed -n 's/.*inet *addr:\([0-9\.]*\).*/\1/p' |
All times are GMT -5. The time now is 08:51 AM. |