Table of Contents

About

A subshell is a process:

How can you create a subshell

With the control operators

( and ) are control operators that executes command in a subshell.

Without the capture

(command1;command2) will execute without capturing the standard stream.

With the capture notation

Example with the capture notation:

foo() {
    >&2 echo "std error";
    echo "std out";
}

echo $(foo)
std error
std out

With a pipeline

Each part of pipeline will create a subshell.

With the ampersand

With the ampersand, you can create a subshell that runs in the background.