Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
deleted 2 characters in body
Source Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k

There are this two names: a subshellsubshell and a child-shellchild-shell.

Yes, a child process will be started by any of this:

sh -c 'echo "Hello"' ( echo "hello" ) echo "$(echo "hello") echo "hello" | cat 

Are all equivalent and share the same name? Do all share the same properties?


POSIX has this definition:

A shell execution environment consists of ....

But the last paragraph of above link has this:

A subshell environment shall be created as a duplicate of the shell environment, except that signal traps that are not being ignored shall be set to the default action.

And specially:

Command substitution, commands that are grouped with parentheses, and asynchronous lists shall be executed in a subshell environment. Additionally, each command of a multi-command pipeline is in a subshell environment; ....

The sh -c 'echo "Hello"' is not included there, should that be called a subshella subshell also?

There are this two names: a subshell and a child-shell.

Yes, a child process will be started by any of this:

sh -c 'echo "Hello"' ( echo "hello" ) echo "$(echo "hello") echo "hello" | cat 

Are all equivalent and share the same name? Do all share the same properties?


POSIX has this definition:

A shell execution environment consists of ....

But the last paragraph of above link has this:

A subshell environment shall be created as a duplicate of the shell environment, except that signal traps that are not being ignored shall be set to the default action.

And specially:

Command substitution, commands that are grouped with parentheses, and asynchronous lists shall be executed in a subshell environment. Additionally, each command of a multi-command pipeline is in a subshell environment; ....

The sh -c 'echo "Hello"' is not included there, should that be called a subshell also?

There are this two names: a subshell and a child-shell.

Yes, a child process will be started by any of this:

sh -c 'echo "Hello"' ( echo "hello" ) echo "$(echo "hello") echo "hello" | cat 

Are all equivalent and share the same name? Do all share the same properties?


POSIX has this definition:

A shell execution environment consists of ....

But the last paragraph of above link has this:

A subshell environment shall be created as a duplicate of the shell environment, except that signal traps that are not being ignored shall be set to the default action.

And specially:

Command substitution, commands that are grouped with parentheses, and asynchronous lists shall be executed in a subshell environment. Additionally, each command of a multi-command pipeline is in a subshell environment; ....

The sh -c 'echo "Hello"' is not included there, should that be called a subshell also?

Source Link
user79743
user79743

Is a sub-shell the same thing as a child-shell

There are this two names: a subshell and a child-shell.

Yes, a child process will be started by any of this:

sh -c 'echo "Hello"' ( echo "hello" ) echo "$(echo "hello") echo "hello" | cat 

Are all equivalent and share the same name? Do all share the same properties?


POSIX has this definition:

A shell execution environment consists of ....

But the last paragraph of above link has this:

A subshell environment shall be created as a duplicate of the shell environment, except that signal traps that are not being ignored shall be set to the default action.

And specially:

Command substitution, commands that are grouped with parentheses, and asynchronous lists shall be executed in a subshell environment. Additionally, each command of a multi-command pipeline is in a subshell environment; ....

The sh -c 'echo "Hello"' is not included there, should that be called a subshell also?