fix(init): ensure hostname is always valid for macOS (#13171)

master
Sergii Tkachenko 9 months ago committed by GitHub
parent 042605ee6b
commit 2fbdfa93f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      oh-my-zsh.sh

@ -99,8 +99,8 @@ done
# Figure out the SHORT hostname
if [[ "$OSTYPE" = darwin* ]]; then
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
# macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
else
SHORT_HOST="${HOST/.*/}"
fi

Loading…
Cancel
Save