bash script how to change input of for loop code example
Example 1: how to collect values from each iteration of a loop and save them bash
results=()
for time in ${seconds_list}; do
results+=($(bc -l <<< "scale=2; ($cur_time-$time)/3600"))
done
# print the results:
printf "%s\n" "${results[@]}"
Example 2: how to collect values from each iteration of a loop and save them bash
VARIABLE=$(for time in ...; do ...; done)