When I want the fully qualified domain name on Linux, I can write ...
hostname --fqdn
To get the same thing on Solaris, is it necessary to write ...
cut -f 2-3 /etc/hosts | grep ^`hostname`\t | cut -f 2
... or is there something more brief?
From here:
You might also be able to use:
or similar.
Your method depends upon the /etc/hosts file being formatted in a particular way, on a S10 system I have to hand it returns loghost which is incorrect.
If set up you can ask the DNS system with
or if you are using NIS then
or you could setup
/etc/nodename
as Dennis suggests.Would two digs be better than one?
Just be mindful of the trailing dot.