Old(er) versions of hostnamectl(1) don't support the "--pretty"
parameter but output verbose text showing all information. So
validate the SHORT_HOST variable afterwards and unset it again
when it contains ":" characters: then the fallback is used.
Tested with hostnamectl(1) of systemd 204.
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null)
elif (( $+commands[hostnamectl] )); then
SHORT_HOST=$(hostnamectl --pretty 2>/dev/null)
+ [[ "$SHORT_HOST" =~ : ]] && unset SHORT_HOST
fi
[[ -z "$SHORT_HOST" ]] && SHORT_HOST=${HOST/.*/}
export SHORT_HOST