Subshells
lastmod 2022-10-06created 2022-10-062 edits
A shell script can itself spawn subprocesses. Thanks to these subshells, a script can be processed in parallel, which ultimately has the same effect as doing multiple tasks at once.
bash syntax
Variables in a subshell are not visible outside the code block the subshell belongs to. These variables cannot be accessed by the parent process or the shell that spawned the subshell, so they are effectively local variables.
Even if the working directory changes in a subshell, it does not affect the parent shell.