diff --git a/rollback_module.sh b/rollback_module.sh index 2364b95..b937132 100755 --- a/rollback_module.sh +++ b/rollback_module.sh @@ -71,9 +71,14 @@ function rebuild_txt { sorted+=( "$key" ) done < <(printf '%s\0' "${!translationArray[@]}" | sort -zV) + sortedEvent=() + while IFS= read -rd '' key; do + sortedEvent+=( "$key" ) + done < <(printf '%s\0' "${!eventArray[@]}" | sort -zV) + currentEvent="" currentNode="" - for index in "${!eventArray[@]}"; do + for index in "${!sortedEvent[@]}"; do # If currentEvent is different than our index, then we just changed event and need to close the precedent # We also closed the next event in line if [[ ${currentEvent} != ${index} && "${currentEvent}" != "" ]]; then @@ -109,7 +114,7 @@ function rebuild_txt { fi done done - # At the last of last event, we go outside the loop so we need to close remaining node and event + # At the end of last event, we go outside the loop so we need to close remaining node and event echo "[/NODE]" >> "${TXT}" echo >> "${TXT}" echo "[/EVENT]" >> "${TXT}"