0
How to get full qualified domain name of a HP-UX machine as like of hostname -f
in linux?
From man pages, hostname
command has no options.
I could get fqdn by reading the /etc/resolv.conf
file, but is it the correct way to do, or do i have to execute a nslookup
command.
bash-4.2# cat /etc/resolv.conf
domain csez.abccor.com
nameserver 192.68.5.11
bash-4.2# cat /etc/resolv.conf | awk '{print $2}' | head -1
csez.abccorp.com
Also, is the below method is correct ?
echo "$(echo `hostname`).$(cat /etc/resolv.conf | awk '{print $2}' | head -1)"