In Linux (Ubuntu 18.04 and RHEL) my /etc/resolv.conf
says:
nameserver 192.168.0.1
search baz.com
And I get this:
getent hosts www
192.168.0.2 www.baz.com
But I'd like to do this:
getent hosts foo
And get this result:
192.168.0.3 foo-bar.baz.com
Where -bar
was appended to foo
prior to resolving .baz.com
.
This approach fails however:
/etc/resolv.conf
search: -bar.baz.com
getent hosts foo
echo $? # returns 2
Is this possible? It seems that search
only appends domain names, not partial matches. Is there a better approach?