Skip to main content
18 events
when toggle format what by license comment
Sep 9 at 8:32 review Close votes
Sep 14 at 3:06
Sep 9 at 8:14 comment added Toby Speight This question is similar to: How to wait for background commands that were executed within a subshell?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.
Sep 8 at 20:54 history became hot network question
Sep 8 at 16:48 comment added k0pernikus @Barmar I think I managed to with trap 'wait' exit, though I sidetrack my requirement of not having to change the subshell's content somewhat; I think it works stable enough.
Sep 8 at 16:41 answer added k0pernikus timeline score: 4
Sep 8 at 15:32 comment added Kusalananda Related to this other question. The only difference is that the subshells here are explicitly constructed. unix.stackexchange.com/q/688207/116858
Sep 8 at 15:28 history edited Kusalananda
edited tags
Sep 8 at 15:08 comment added Barmar The only solution I can think of would be to have the subshells each wait for their background processes and then write something to a file or pipe, and then have the main shell wait for the messages in that file/pipe.
Sep 8 at 15:05 comment added Barmar A process can only wait for background processes that are its immediate children. When you run the background processes from subshells, that breaks the link with the original shell and it can't wait for them.
Sep 8 at 14:46 comment added Stephen Kitt I’ve reopened this question. For the record the reference question was Bash wait for all subprocesses of script, and while one of the answers mentions the problem with background tasks started from a subshell, it doesn’t provide a solution.
Sep 8 at 14:44 history reopened k0pernikus
Stephen Kitt bash
Sep 8 at 14:34 comment added k0pernikus Voted to reopen: My solution I thought I had was not correct. The marked as duplicate answers don't deal with subshells.
Sep 8 at 14:34 review Reopen votes
Sep 8 at 14:53
Sep 8 at 14:32 history edited k0pernikus CC BY-SA 4.0
added 626 characters in body
Sep 8 at 13:11 history closed Stephen Kitt bash Duplicate of Bash wait for all subprocesses of script
Sep 8 at 12:50 history edited k0pernikus CC BY-SA 4.0
added 85 characters in body
Sep 8 at 12:43 comment added k0pernikus Related / somewhat of a follow up to my question: unix.stackexchange.com/q/798660/12471
Sep 8 at 12:42 history asked k0pernikus CC BY-SA 4.0