From 398daf619fc8970d8a3c89c561a40054eba83bea Mon Sep 17 00:00:00 2001 From: olli Date: Tue, 4 Jun 2024 15:13:00 +0200 Subject: [PATCH] fix --- dabo/functions/currency_converter.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dabo/functions/currency_converter.sh b/dabo/functions/currency_converter.sh index 49ff90b..195614a 100644 --- a/dabo/functions/currency_converter.sh +++ b/dabo/functions/currency_converter.sh @@ -7,9 +7,9 @@ function currency_converter { local f_currency_target=$3 local f_currency_date=$4 - unset f_currency_converter_result - local f_reverse=false - local f_line f_rate f_histfile f_date_array f_stablecoin + unset f_currency_converter_result + + local f_line f_rate f_histfile f_date_array f_stablecoin f_reverse # get current date if none given [ -z "$f_currency_date" ] && printf -v f_currency_date '%(%Y-%m-%d %H:%M:%S)T' @@ -83,6 +83,7 @@ function currency_converter { [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_day" "$f_histfile" | tail -n1) [ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_month" "$f_histfile" | tail -n1) [ -n "$f_line" ] && f_rate=$(echo "$f_line" | cut -d, -f2) + f_reverse=false if [ -n "$f_rate" ] then [[ $f_histfile =~ ${f_currency}${f_currency_target} ]] && f_reverse=true