From d2728f0dd1fd301f6de2250053485553673aafd3 Mon Sep 17 00:00:00 2001 From: David McKay Date: Mon, 25 Apr 2016 07:08:36 +0100 Subject: [PATCH] Consolidated if statements and fixed OSX cpu cores command --- powerlevel9k.zsh-theme | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4fd7ecf4..0f321bc3 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -580,12 +580,6 @@ prompt_load() { local current_state="unknown" local cores - if [[ "$OS" == "OSX" ]]; then - cores=$(sysctl -a | grep machdep.cpu) - else - cores=$(nproc) - fi - typeset -AH load_states load_states=( 'critical' 'red' @@ -595,8 +589,10 @@ prompt_load() { if [[ "$OS" == "OSX" ]]; then load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) + cores=$(sysctl -n hw.physicalcpu) else load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) + cores=$(nproc) fi # Replace comma