From a9008c7c26046fce3e058720484aea609e499347 Mon Sep 17 00:00:00 2001 From: olli <> Date: Tue, 18 Jun 2024 22:56:51 +0200 Subject: [PATCH] read csv files to vars --- gaboshlib/g_read_csv.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gaboshlib/g_read_csv.sh b/gaboshlib/g_read_csv.sh index f333859..655150c 100644 --- a/gaboshlib/g_read_csv.sh +++ b/gaboshlib/g_read_csv.sh @@ -56,6 +56,8 @@ function g_read_csv { g_csv_array=("${g_csv_array_ref[@]}") # go reverse through array + declare -Ag v_csv_array_associative + declare -Ag v_csv_array_associative_reverse l=0 for (( r=${#g_csv_array[@]}-1 ; r>=0 ; r-- )) do @@ -67,7 +69,8 @@ function g_read_csv { #declare -g v_${l}_${g_headline_item}="${g_csv_line_array[i]}" # last line to vars without number [ "$l" = 0 ] && declare -g v_${g_headline_item}="${g_csv_line_array[i]}" - v_csv_array_associative[${g_headline_item}_${l}]="${g_csv_line_array[i]}" + v_csv_array_associative[${g_headline_item}_${r}]="${g_csv_line_array[i]}" + v_csv_array_associative_reverse[${g_headline_item}_${l}]="${g_csv_line_array[i]}" ((i++)) done ((l++))