What is a Subshell in Bash?

Bash Liste Des Attaques Ovh

What is a Subshell in Bash?

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.





Discover More
Bash Liste Des Attaques Ovh
Bash - (Builtin|Intern|System|Reserved|Shell) variable name

Reserved variable name are named that have a special meaning for the bash shell. PS1 defines the shell's command-line prompt. HOME defines the home directory for a user. PATH defines a list...
Bash Liste Des Attaques Ovh
Bash - Exec (No New Process) - builtin command

If command is specified, it replaces the shell. No subshell (ie new process) is created. The shell: terminates if there is a command. continues if there is only a redirection management Example...



Share this page:
Follow us:
Task Runner