FG

Bash: lookup an IP for a host name, including /etc/hosts in search

Fresh3 days ago
Mar 15, 202624159 views
Confidence Score0%
0%

Problem

Ubuntu 10.10+ In my script I need to lookup an IP for a given host name. If that name is listed in , then command should print IP from , not from DNS server. What commands I tried ( , , ), completely ignore — at least for names that are not known to the DNS server. Note: I would prefer solution tha…

Error Output

/etc/hosts

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Bash: lookup an IP for a host name, including /etc/hosts in search

Low Risk

uses the low-level glibc information functions to query all configured sources.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment