On Solaris this worked well for me: sorry for the backtick, it is the reversed quote next to number 1 on a qwerty keyboard or you can use $( command) in KSH
getent hosts (backtick) /usr/bin/hostname (backtick)
getent hosts (backtick) /usr/bin/hostname (backtick) OR getent hosts $(/usr/bin/hostname)or
getent hosts $(/usr/bin/hostname)
example: root@melauto:[/]# getent hosts $(/usr/bin/hostname)
10.4.19.241 melauto.sro.vic.gov.au melauto loghost root@melauto:[/]#
root@melauto:[/]# getent hosts $(/usr/bin/hostname)
10.4.19.241 melauto.sro.vic.gov.au melauto loghost
root@melauto:[/]#
getent queries the current name search mechanism as specified in /etc/nsswitch.conf
and returns the information that matches the search, here it returns the info as found in /etc/hosts/etc/hosts. if you lookup for the host info for another host that is not in /etc/hosts/etc/hosts, it will look in DNS provided that is what is defined in /etc/nsswitch.conf
Good luck
Blaise/etc/nsswitch.conf