I would like a command that will resolve a hostname to an IP address, in the same way that a normal program would resolve the hostname. In other words, it has to take into account mDNS (.local
) and /etc/hosts
, as well as regular DNS. So that rules out host
, dig
, and nslookup
, since all three of those tools only use regular DNS and won't resolve .local
addresses.
On Linux, the getent
command does exactly what I want. However, getent
does not exist on OS X.
Is there a Mac OS X equivalent of getent
? I'm aware that I could write one in a few lines using getaddrinfo
, and that's what I'll do if I have to, but I was just wondering if there was already a standard command that could do it.
Thanks!