nicer bash code

This commit is contained in:
olli 2024-02-07 10:37:30 +01:00
parent e3670179ec
commit f27dbaaae4

View File

@ -41,11 +41,10 @@ function get_vars_from_csv {
get_var_from_line price 2
# get newest price from raw file if this is a non-full loop
# TODO: Nicer pure-bash code
if [ ${FULL_LOOP} == 0 ]
then
f_ASSET_HIST_FILE_RAW=$(echo ${f_ASSET_HIST_FILE} | sed 's/.csv$/-raw.csv/')
f_price=$(tail -n1 "${f_ASSET_HIST_FILE_RAW}" | cut -d, -f2)
readarray -d "," -t f_last_line_raw_array < <(tail -n1 "${f_ASSET_HIST_FILE/.csv/-raw.csv}")
f_price=${f_last_line_raw_array[1]}
fi
get_var_from_line price_change 3