Bash
Subshells
https://tldp.org/LDP/abs/html/subshells.html
Parentheses ()
spawn a subshell, which is effectively a new sub-process. Interestingly, the spawned sub-shells are not forked off asynchronously by default, but require an explicit &
.
# synchronous subshell
(
command
command
command
)
# control gets here after subshell is done
# asynchronous subshells (parallel)
(
command
command
command
) &
(
command
command
command
) &
# control gets here immediately
wait # wait until subshells are done