How to find out dynamic IP address in a script?
I am writing a script, which should somehow find out what dynamic IP address is assigned to the local machine.
Is there an easy and generic way (say... checking an environment variable?) to find it?
I know ifconfig shows the IP address, but I found it hard to find a common way to grep it out, since the list has a different structure on the two unixes I have access to.
I also know that it may be found (and easily grepped out) in /var/log/messages, but I do not know if it is always there.
So, is there an other solution?