📜  如何从循环的每次迭代中收集值并保存它们 bash - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:30.480000             🧑  作者: Mango

代码示例2
results=()

for time in ${seconds_list}; do
    results+=($(bc -l <<< "scale=2; ($cur_time-$time)/3600"))
done

# print the results:

printf "%s\n" "${results[@]}"