[TriLUG] Syntax checker for /etc/hosts ?

Kevin Hunter Kesling hunteke at earlham.edu
Fri Oct 25 13:28:43 EDT 2013


On 10/24/2013 04:58 PM, Jeremy Portzer wrote:
> Is there any standard command to check the syntax and "sanity" in
> /etc/hosts?

> While I could write a short script easily enough to do this, I
> thought it might be a common problem and there may be some other
> standard way to check it.

Not of which I'm aware, but a sysadmin colleague from a former job used 
a script he created for the purpose of helping out those less skilled in 
the ways of Vi.  I think this is an old draft, but it gets the job done.

This list doesn't do attachments, so I've pasted it to pastebin:

     http://pastebin.com/qyrq7RUT

He was (is?) a bit of a whitespace nazi, but he was also a damn good 
sysadmin.

It's GPL, so edit it for your needs, if you like.

Cheers,

Kevin


More information about the TriLUG mailing list