Resolved: Bash: lookup an IP for a host name, including /etc/hosts in search #answer #dev #development
Resolved: Bash: lookup an IP for a host name, including /etc/hosts in search #answer #dev #development
Bash: lookup an IP for a host name, including /etc/hosts in search
Ubuntu 10.10+
In my script I need to lookup an IP for a given host name.
If that name is listed in /etc/hosts, then command should print IP from /etc/hosts, not from DNS server.
What commands I tried (nslookup, dig, host), completely ignore /etc/hosts — at least for names that are not known to the DNS server.
Note: I would prefer…
View On WordPress


















