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++))