more pure bash to speed up things

This commit is contained in:
olli 2023-11-11 18:04:25 +01:00
parent 3cc2d1aa41
commit 1e7b7ec8d9

View File

@ -12,19 +12,17 @@ function get_vars_from_csv {
f_market_performance="-50" f_market_performance="-50"
fi fi
f_all_vars="f_market_performance=${f_market_performance}" f_all_vars="f_market_performance=${f_market_performance}"
set -x
# read last 4 lines in array if not given # read last 4 lines in array if not given
if [ -z "${f_last_lines_array}" ] if [ -z "${f_last_lines_array}" ]
then then
mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}") mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}")
fi fi
set -x
# if there are not four lines # if there are not four lines
[ -z "${f_last_lines_array[3]}" ] && return 1 [ -z "${f_last_lines_array[3]}" ] && return 1
# create array of last line fields # create array of last line fields
#f_last_line="$(tail -n1 "${f_ASSET_HIST_FILE}"),${f_market_performance}" #f_last_line="$(tail -n1 "${f_ASSET_HIST_FILE}"),${f_market_performance}"
f_last_line="${f_last_lines_array[3]},${f_market_performance}" f_last_line="${f_last_lines_array[3]},${f_market_performance}"