summaryrefslogtreecommitdiff
path: root/oh-my-zsh.sh
diff options
context:
space:
mode:
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r--oh-my-zsh.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index a90b3e98a..d0e89f31b 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -38,9 +38,9 @@ for plugin ($plugins); do
done
# Figure out the SHORT hostname
-if [ -n "$commands[scutil]" ]; then
- # OS X
- SHORT_HOST=$(scutil --get ComputerName)
+if [[ "$OSTYPE" = darwin* ]]; then
+ # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
+ SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
else
SHORT_HOST=${HOST/.*/}
fi