diff --git a/liquidprompt b/liquidprompt index d560f69..c105154 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1174,22 +1174,23 @@ _lp_load_color() [[ "$LP_ENABLE_LOAD" != 1 ]] && return - local load - load="$(_lp_cpu_load | sed 's/\.//g;s/^0*//g' )" - let "load=${load:-0}/$_lp_CPUNUM" + local tmp=$(_lp_cpu_load) + tmp=${tmp/./} # Remove '.' + tmp=${tmp#0} # Remove leading '0' + tmp=${tmp#0} # Remove leading '0', again (ex: 0.09) + local -i load=${tmp:-0}/$_lp_CPUNUM - if [[ $load -ge $LP_LOAD_THRESHOLD ]] - then - local ret="$(_lp_color_map $load) ${LP_MARK_LOAD}" + if (( load > $LP_LOAD_THRESHOLD )); then + local ret="$(_lp_color_map $load)${LP_MARK_LOAD}" - if [[ "$LP_PERCENTS_ALWAYS" -eq "1" ]]; then + if [[ "$LP_PERCENTS_ALWAYS" == 1 ]]; then if $_LP_SHELL_bash; then ret="${ret}$load%" else # zsh ret="${ret}$load%%" fi fi - echo -ne "${ret}${NO_COL}" + echo -nE "${ret}${NO_COL}" fi }