iankelling.org
/
git
/
automated-distro-installer
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
9fa57d07db3e997ab955db6dfa6a12ca3327a81d
[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
=
$
(
host
$host
)
11
addr
=
${addr##* }
12
h
=
$
(
host
$addr
)
13
h
=
${h##* }
14
echo
${h%%.*}