store a value in a variable in a loop shell script code example
Example: how to assign values from a loop in bash to a single variabel
results=()
for time in ${seconds_list}; do
results+=($(bc -l <<< "scale=2; ($cur_time-$time)/3600"))
done
# print the results:
printf "%s\n" "${results[@]}"