5

Possible Duplicate:
Linux command line utility to resolve host names wrt. /etc/hosts

Let's say I have an entry in my /etc/hosts

1.2.3.4 example.com

To look up example.com, I can use the commands like host, nslookup and dig, but they only do a DNS lookup (while ignoring /etc/hosts). I want a clean and easy way to run

mylookupcmd example.com

that first checks /etc/hosts and if that fails, does a DNS lookup.

I can do

ping example.com | my-scraper-that-outputs-ip-address

and get the IP address, but that's not a "clean" solution.

slowpoison
  • 151
  • 3

0 Answers0