From e79a8707f0587bbced6eaff188343383d40f9c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Mon, 17 Jun 2013 21:09:43 +0200 Subject: [PATCH] FreeBSD, Darwin: _lp_cpu_load improvements FreeBSD: fixed _lp_cpu_load Darwin: optimized _lp_cpu_load Note that this change may break syntax coloring in Vim if Vim is not configured to read the file as 'bash'. Workaround: create a symbolic link with a '.bash' extension and open that file. --- liquidprompt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/liquidprompt b/liquidprompt index ae6e6ce..f59eb90 100755 --- a/liquidprompt +++ b/liquidprompt @@ -114,14 +114,17 @@ case "$LP_OS" in FreeBSD) _lp_cpu_load () { local bol load eol - read bol load eol < $<( LANG=C sysctl -n vm.loadavg ) + # If you have problems with syntax coloring due to the following + # line, do this: ln -s liquidprompt liquidprompt.bash + # and edit liquidprompt.bash + read bol load eol <<<$( LANG=C sysctl -n vm.loadavg ) echo "$load" } ;; Darwin) _lp_cpu_load () { - local load - load=$(LANG=C sysctl -n vm.loadavg | awk '{print $2}') + local bol load eol + read bol load eol <<<$( LANG=C sysctl -n vm.loadavg ) echo "$load" } LP_DWIN_KERNEL_REL_VER=$(uname -r | cut -d . -f 1)