[CALUG] /etc/hosts not used?

Chris Edillon jce at zot.com
Sun Mar 19 11:03:28 CST 2006


On Sun, 2006-03-19 at 07:37 -0500, Eldon Ziegler wrote:

> In looking for a command to use in a shell script that would first 
> search /etc/hosts and then DNS I didn't want to reinvent the wheel 
> but, in this case, there doesn't seem to be a wheel so I wrote a C 
> routine to printf the result of gethostbyname () which seems to do 
> the search in the order I want.
> 
  the getent command will do what you want, it's a program which
does various get* routine lookups:

getent hosts foo.bar.com
getent passwd username
getent group groupname
etc.

chris



More information about the lug mailing list