<p>There are several command line utilities to resolve host names (<code>host</code>, <code>dig</code>, <code>nslookup</code>), however they all use nameservers exclusively, while applications in general look in <code>/etc/hosts</code> first (using gethostbyname I believe).</p>
<p>Is there a command line utility to resolve host names that behaves like a usual application, thus looking in <code>/etc/hosts</code> first and only then asking a nameserver?</p>
<p>(I am aware that it would probably be like 3 lines of c, but I need it inside of a somewhat portable shell script.)</p>