This commit is contained in:
olli 2024-06-04 15:13:00 +02:00
parent c0fe474c19
commit 398daf619f

View File

@ -8,8 +8,8 @@ function currency_converter {
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
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