If you want to write a script that can resolve an interface IP address, then perform a DNS lookup on the IP (basically an interface to hostname lookup), see the following page:
Resolving an IP Address and Hostname