From 9a7069dbcb454fe1b786d7a80615f1a98f523e54 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Sat, 4 Jan 2014 23:39:16 +0100 Subject: [PATCH] Refactors short host retrieval. --- oh-my-zsh.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 836810c4e..30b55fb4e 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -31,16 +31,12 @@ find_plugin_paths() { } initialize_completions() { - # Figure out the SHORT hostname - if [ -n "$commands[scutil]" ]; then - # OS X - SHORT_HOST=$(scutil --get ComputerName) - else - SHORT_HOST=${HOST/.*/} - fi + # Figure out the SHORT hostname, scutil is for OS X users + local short_host + short_host=$($(scutil --get ComputerName 2>/dev/null) || echo ${HOST/.*/}) # Save the location of the current completion dump file. - ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" + ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${short_host}-${ZSH_VERSION}" # plugins need to be added to the functions path before compinit fpath=($ZSH_PLUGIN_PATHS $fpath)