DNS in Shell Scripts

Some of us still do shell scripting . Name lookups are seldom necessary in shell scripts, but sometimes you do need them. Of course, you can call Perl or some other script language that has gethostbyname (or gethostbyaddr as the case may be), but that is quite expensive. One of the easiest programs to use in shell scripts is the host program that is part of the BIND distribution. Unfortunately, it is not always installed. The reason host is the easiest to use is that its output format is the simplest. Dig and nslookup all provide copious output, most of which is irrelevant if you just want the address of a machine.

With PPP, you usually have an ip-up script, which is run when the PPP interface is configured and up. It is ...

Get Concise Guide to DNS and BIND, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.