[CALUG] /etc/hosts not used?
david l goodrich
dlg at dorkzilla.org
Sun Mar 19 21:59:18 CST 2006
Jeremy Portzer wrote:
> On Sun, 19 Mar 2006, Chris Edillon wrote:
>
>> 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.
>
> Awesome Chris. That's exactly what we're all looking for.
>
> getent is provided by the glibc package on my system, so that indicates
> this ought to be a widespread command available on almost every system,
> which fits the bill for a portable shell script.
assuming you're porting your script only to linux. it doesn't work on
netbsd, openbsd, or OS X.
dlg at fawkes:~$ uname -mrs
NetBSD 2.0.2 i386
dlg at fawkes:~$ getent
bash: getent: command not found
dlg at fawkes:~$
[dlg at neptune /home/dlg]$ uname -mrs
OpenBSD 3.8 sgi
[dlg at neptune /home/dlg]$ getent
ksh: getent: not found
[dlg at neptune /home/dlg]$
dlg at elektra:~$ uname -mrs
Darwin 8.5.0 Power Macintosh
dlg at elektra:~$ getent
-bash: getent: command not found
dlg at elektra:~$
i don't have access to a freeBSD machine, but it doesn't seem hopeful:
http://www.freebsd.org/cgi/man.cgi?query=getent
[snip]
Sorry, no data found for `getent'.
You may look for other FreeBSD Search Services.
[snip]
oh, scratch the "just linux" part. solaris seems okay.
dlg at bigmac:~$ uname -mrs
SunOS 5.10 sun4u
dlg at bigmac:~$ getent hosts example.com
192.0.34.166 example.com
dlg at bigmac:~$
just as a heads-up.
--david
>
> Thanks.
>
> Jeremy Portzer
>
More information about the lug
mailing list