fix g_calc with result-var

This commit is contained in:
olli 2023-11-26 16:24:30 +01:00
parent 8ce8c248db
commit 93bb065899
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,7 @@
function g_calc { function g_calc {
unset g_calc_result
# Use bc in backround for multiple bc's running much faster # Use bc in backround for multiple bc's running much faster
if [ -z "${g_bc_running}" ] if [ -z "${g_bc_running}" ]
then then
@ -49,6 +51,6 @@ function g_calc {
return 1 return 1
fi fi
# echo result # store result
g_calc_result="${g_sed_out}" g_calc_result="${g_sed_out}"
} }

View File

@ -48,6 +48,7 @@ function g_num_is_lower {
# Check for valid number # Check for valid number
g_num_valid_number "$f_num" "$f_checkhigher" || return 1 g_num_valid_number "$f_num" "$f_checkhigher" || return 1
g_calc "${f_num} < ${f_checkhigher}"
if [ ${g_calc_result} -ne 0 ] if [ ${g_calc_result} -ne 0 ]
then then
return 0 return 0