Il y a plusieurs command line utilities to resolve host names (`host`, `dig`, `nslookup`), however they tous use nameservers exclusively, tandis que applications in general look in `/etc/hosts` premier (using gethostbyname I believe).
Is there a command line utility to resolve host names that behaves like a usual application, thus looking in `/etc/hosts` premier et seulement alors asking a nameserver?
(Je suis aware that it would probably be like 3 lines of c, mais J'ai besoin de it inside of a somewhat portable shell script.)
Utilitaire Linux en ligne de commande pour résoudre les noms d'hôte en utilisant /etc/hosts en priorité
Re: Utilitaire Linux en ligne de commande pour résoudre les noms d'hôte en utilisant /etc/hosts en priorité
Ceci est easily achieved avec `getent`:
```
getent hosts 127.0.0.1
```
`getent` will do lookups for tout type of data configured in `nsswitch.conf`.
```
getent hosts 127.0.0.1
```
`getent` will do lookups for tout type of data configured in `nsswitch.conf`.