comparison contrib/guess-hostname @ 162:71dcdc2020bc

guess-hostname: ordered guesses by quality
author meillo@marmaro.de
date Thu, 08 Jul 2010 12:19:11 +0200
parents 60c92aa59911
children 92b58989a09e
comparison
equal deleted inserted replaced
161:6dd3a289989b 162:71dcdc2020bc
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # try several ways to guess the hostname 3 # try several ways to guess the hostname
4 # earlier output lines are probably better
4 5
5 ( 6 (
6 7
7 # this is what Debian uses 8 # this is what Debian uses
8 cat /etc/mailname 9 cat /etc/mailname
9 10
11 # probably a good value on GNU/Linux
12 hostname -f
13
10 # this is often the short hostname 14 # this is often the short hostname
11 cat /etc/hostname 15 cat /etc/hostname
16
17 # often the short hostname, but widely available
18 hostname
12 19
13 # this file was mentioned on the Internet 20 # this file was mentioned on the Internet
14 cat /etc/HOSTNAME 21 cat /etc/HOSTNAME
15 22
16 # probably a good value on GNU/Linux 23 ) 2>/dev/null
17 hostname -f
18
19 # often the short hostname, but widely available
20 hostname
21
22 ) 2>/dev/null | sort -u