mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
Merge pull request #2743 from docwhat/issue-2155-scutil
Trust but verify 'scutil' to return ComputerName
This commit is contained in:
commit
dd644a1fa9
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue