From 051e3608d711e0d2bf3ac482662c9fd07f1e27a4 Mon Sep 17 00:00:00 2001 From: aristocratos Date: Sun, 26 Apr 2020 10:11:22 +0200 Subject: [PATCH] get_value function: fixed regex and added proper float to int rounding --- bashtop | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bashtop b/bashtop index 27f00b7..a7965e9 100755 --- a/bashtop +++ b/bashtop @@ -750,8 +750,9 @@ get_value() { #? Get a value from a file, variable or array by searching for a n done fi - if [[ -n $int && $found =~ . ]]; then - found=${found%.*} + if [[ -n $int && $found =~ [.|,] ]]; then + found="${found/,/.}" + printf -v found "%.0f" "${found}" fi if [[ -n $math && -n $int ]]; then