view contrib/guess-hostname @ 218:92b58989a09e

small improvement of guess-hostname uniq'ed the output and always exit successful
author meillo@marmaro.de
date Wed, 21 Jul 2010 22:10:13 +0200 (2010-07-21)
parents 71dcdc2020bc
children
line wrap: on
line source
#!/bin/sh
#
# try several ways to guess the hostname
# earlier output lines are probably better

(

# this is what Debian uses
cat /etc/mailname

# probably a good value on GNU/Linux
hostname -f

# this is often the short hostname
cat /etc/hostname

# often the short hostname, but widely available
hostname

# this file was mentioned on the Internet
cat /etc/HOSTNAME

) 2>/dev/null | uniq

exit 0