]> arthur.barton.de Git - ax-zsh.git/blobdiff - core/30_hostname/30_hostname.zprofile
30_hostname: Validate SHORT_HOST variable
[ax-zsh.git] / core / 30_hostname / 30_hostname.zprofile
index a976ecd1bd95db059f68406788e1a6775cdc8800..5b2dbd3faa15899af1295095b6f2cfd451f0bdf1 100644 (file)
@@ -10,6 +10,7 @@ if (( $+commands[scutil] )); then
        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