mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
Under OSX the output of sysctl vm.loadavg
may be localized. With german locale it will print an comma as separator..
This commit is contained in:
parent
815582ffe0
commit
ae77fc17d8
1 changed files with 4 additions and 1 deletions
|
@ -613,7 +613,7 @@ prompt_ip() {
|
|||
|
||||
prompt_load() {
|
||||
if [[ "$OS" == "OSX" ]]; then
|
||||
load_avg_5min=$(sysctl vm.loadavg | grep -o -E '[0-9]+\.[0-9]+' | head -n 1)
|
||||
load_avg_5min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1)
|
||||
ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+')
|
||||
# Convert pages into Bytes
|
||||
ramfree=$(( $ramfree * 4096 ))
|
||||
|
@ -624,6 +624,9 @@ prompt_load() {
|
|||
base=K
|
||||
fi
|
||||
|
||||
# Replace comma
|
||||
load_avg_5min=${load_avg_5min//,/.}
|
||||
|
||||
if [[ "$load_avg_5min" -gt 10 ]]; then
|
||||
BACKGROUND_COLOR="red"
|
||||
FUNCTION_SUFFIX="_CRITICAL"
|
||||
|
|
Loading…
Reference in a new issue