There is a command called domainname in Unix. However, the 'domainname' command returns the NIS domain name. This is unrelated to the DNS domain, although you could set them to be the
same. Unfortunately, there's no general way to obtain the DNS domain. Parsing the 'domain' line from /etc/resolv.conf is probably the best way. If the local hostname is fully-qualified, you could split it at the first dot to obtain the hostname. If it isn't, you could qualify it with a DNS lookup first.
awk '$1=="domain" {print $2}' /etc/resolv.conf
Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps
Showing posts with label domain name. Show all posts
Showing posts with label domain name. Show all posts
Friday, August 8, 2008
Subscribe to:
Posts (Atom)