On Wed, Sep 2, 2009 at 2:23 PM, River
Tarnell<river(a)loreley.flyingparchment.org.uk> wrote:
there is no --fqdn option either. hostname on Solaris
does not accept
any options.
I ended up using this in my .bash_aliases:
if ([ `uname` = 'Linux' ] && (hostname --fqdn | grep toolserver
&>/dev/null)) \
|| ([ `uname` = 'SunOS' ] && (check-hostname | grep toolserver
&>/dev/null))
Clearly, users of non-bash shells should use >/dev/null 2>&1 instead
of &>/dev/null. It's probably cleaner to do `which check-hostname
/dev/null` instead of the explicit OS check. So you
could do
if ! `which check-hostname >/dev/null`; then
alias check-hostname='hostname --fqdn'
fi
Then use check-hostname as you like. Of course, from the man page, it
looks like check-hostname is part of sendmail, so I don't know how
reliably available it is, but it's worked for me so far. :P