Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
" "${results[@]}"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #collect #values #iteration #loop #save #bash
ADD COMMENT
Topic
Name
9+5 =