更新时间:2021-12-06 22:08:58
查看 bash subshells,这些可用于并行运行脚本的一部分.
Check out bash subshells, these can be used to run parts of a script in parallel.
我还没有测试过,但这可能是一个开始:
I haven't tested this, but this could be a start:
#!/bin/bash
for i in $(seq 1 1000)
do
( Generating random numbers here , sorting and outputting to file$i.txt ) &
if (( $i % 10 == 0 )); then wait; fi # Limit to 10 concurrent subshells.
done
wait