当运行shell脚本启动nohup进程时,如何对它们进行排队以确保它们都不';你不能同时跑吗?

当运行shell脚本启动nohup进程时,如何对它们进行排队以确保它们都不';你不能同时跑吗?,shell,nohup,Shell,Nohup,我有一个基本的shell脚本,它循环遍历给定目录中的所有文件,并通过python程序运行它们: for entry in *".wav" do coll=$(echo "$entry" | cut -f 1 -d '.') echo $name nohup python3 transcription.py $coll & done tail -f nohup.out echo "end of batch." 但我想

我有一个基本的shell脚本,它循环遍历给定目录中的所有文件,并通过python程序运行它们:

for entry in *".wav"
do
  coll=$(echo "$entry" | cut -f 1 -d '.')
  echo $name
  nohup python3 transcription.py $coll &
done
tail -f nohup.out
echo "end of batch."

但我想把这个限制在5到10个进程。如何对这些进程进行排队,使它们在前一个进程完成之前不会启动?

也许可以使用类似GNU Parallel的程序,它允许您指定批处理大小,并将管理所有进程。@Barmar看起来可能就是我要找的。谢谢你的提示!如果我能找到一个解决方案,我会更新。@Barmar这个解决方案工作得很好。非常感谢。