Operating System - HP-UX
1855069 Members
8884 Online
104109 Solutions
New Discussion

Re: command host returns value "reached"

 
SOLVED
Go to solution
Alexander Mironov
Occasional Contributor

command host returns value "reached"

Hello,

I try to determine ip address of the host, using command $host in HP-UX.
But it returns value "reached" instead of the ip address.
Does anybody clarify, where I am wrong?
DNS is not configured - I use /etc/hosts only.
So, file /etc/resolv.conf is absent.
File /etc/nsswitch.conf has the next order:
hosts files (ONLY!).
6 REPLIES 6
mobidyc
Trusted Contributor
Solution

Re: command host returns value "reached"

Hello,

from the man pages

nslookup(1)
nslookup is a program to query Internet domain name servers. nslookup has been extended to follow the configured name resolution algorithm of the host and to query NIS, as well as, DNS and host tables.

host(1)
host is a simple utility for performing DNS lookups.

acording to hese informations, the host command cannot query files for resolution.

instead of using host, prefer using nslookup.

BR,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Alexander Mironov
Occasional Contributor

Re: command host returns value "reached"

Well...
Is it possible to obtain ip address of the host without any other information, using command nslookup?
mobidyc
Trusted Contributor

Re: command host returns value "reached"

Hello,

NS_RESULT="$(LANG=C nslookup )"
[ "$?" = "0" ] && {
IP="$(echo "$NS_RESULT" |grep "^Address:" |tail -1 |awk '{print $2}')"
}

BR,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Alexander Mironov
Occasional Contributor

Re: command host returns value "reached"

Thank you!
Alexander Mironov
Occasional Contributor

Re: command host returns value "reached"

thanks
mobidyc
Trusted Contributor

Re: command host returns value "reached"

Hello,

don't forget do assign points when you have answers.

BR,
Cedrick Gaillard
Best regards, Cedrick Gaillard