diff options
author | Robby Russell <robby@planetargon.com> | 2014-09-03 15:51:30 +0200 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2014-09-03 15:51:30 +0200 |
commit | dd644a1fa9d3251ee53b6bfcc10efff08f2ec3b5 (patch) | |
tree | 17b151b73bf3e67eb3f25d0d92954347a7f7ae48 /oh-my-zsh.sh | |
parent | ca0331da511551bfe09fe63378c94a9fb27eb370 (diff) | |
parent | 00b21d5ac322178b9b9e397b0b6178a3d7f4e9ee (diff) | |
download | zsh-dd644a1fa9d3251ee53b6bfcc10efff08f2ec3b5.tar.gz zsh-dd644a1fa9d3251ee53b6bfcc10efff08f2ec3b5.tar.bz2 zsh-dd644a1fa9d3251ee53b6bfcc10efff08f2ec3b5.zip |
Merge pull request #2743 from docwhat/issue-2155-scutil
Trust but verify 'scutil' to return ComputerName
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r-- | oh-my-zsh.sh | 6 |
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 |