iankelling.org
/
git
/
automated-distro-installer
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
better doc for faiserver-disable
[automated-distro-installer]
/
chost
1
#!/bin/bash
2
# Copyright (C) 2016 Ian Kelling
3
4
# chost: get canonical hostname
5
6
set -eE -o
pipefail
7
trap
'echo "
$0
:
$LINENO
:error:
\"
$BASH_COMMAND
\"
returned $?" >&2'
ERR
8
9
host
=
$1
10
addr
=
$
(
getent hosts
$host
|
awk
'{print
$1
}'
)
11
h
=
$
(
getent hosts
$addr
|
awk
'{print
$2
}'
)
12
echo
${h%%.*}