Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 3
    You are probably asking the wrong question. You want to use wait -n -p var in a loop to wait for the next job to finish and keep track of which jobs have not yet finished yourself, rather then seeing which jobs have not yet reported their exit status. Commented Jun 28, 2021 at 5:50
  • 2
    See what parallel(1) is (its basic variant or GNU parallel). Maybe you're trying to reinvent it. Commented Jun 28, 2021 at 6:07
  • Thanks a lot for your answers. parellel seems indeed an option but I have already setup all my scripts. The hint from @icarus using wait -n was easy to integrate into the existing scripts and works great. Commented Jun 28, 2021 at 6:28
  • 1
    You might check my post here: unix.stackexchange.com/questions/654362/…. This can run any mix of commands it is given. I think parallel will only run many instances of the same command. Commented Jun 28, 2021 at 7:16
  • @icarus: If you post your reply as an answer then I can set it as the accepted answer (because I am using your solution). Commented Jul 1, 2021 at 17:11