-# Convert datesDiscont into array (for how to process each line in a multiline variable, see https://superuser.com/a/284226 )
-while IFS= read -r line; do
- #echo "$line"
- #datesDiscontArray+="$line"
- datesDiscontArray+=($(date --date="$line" +%s))
- #echo ${datesDiscontArray[-1]}
-done <<< "$datesDiscont"
-#yell ${datesDiscontArray[@]}
+ # Sort datesDiscontArray
+ while read -r line; do
+ datesDiscontArray+=("$line");
+ done < <(printf "%s\n" "${datesDiscontArray[@]}" | sort);