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.
This commit is contained in:
Olivier Mengué 2013-06-17 21:09:43 +02:00
parent 4492860d59
commit e79a8707f0

View File

@ -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)