2 # Copyright (C) 2016 Ian Kelling
4 # chost: get canonical hostname
7 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
10 # ||: because if we are using 2+ resolvers, 1 may fail, causing error, but we still get
11 # a valid address and we just use that
12 addr
=$
(host $host |
sed -rn 's/^\S+ has address //p;T;q' ||
:)
16 echo "error: chost: $h" >&2
21 # trailing dot in a hostname will mess up rsync