for ((i=0; i<${#IN_FILES[@]}; i++)); do if ((CHAPTERS > 0)); then if [[ ${GROUP[i]} ]]; then while read line; do group_chapt_array=( "${group_chapt_array[@]}" "$(for p in $line; do echo -n $(format_seconds $p),; done)" ) done <<< $( make_group_chapters "${GROUP_CHAPTERS[i]}") fi fi done # each element gets all lines of output rather than one line per element