Which of the following commands created a bash subshell?
- bash
- bsh
- csh
- None of the above
This question asked in recent exam and i was unable to answer. Can any one give me right answer?
Which of the following commands created a bash subshell?
- bash
- bsh
- csh
- None of the above
This question asked in recent exam and i was unable to answer. Can any one give me right answer?
None of them (alternative 4).
A sub-shell is created in various situations, but the commands that you show creates child shells by starting a separate shell interpreter process (although I'm not sure what bsh
is).
A sub-shell is, for example created inside (...)
, as well as in $(...)
(a command substitution), <(...)
and >(...)
(process substitution), and for the various stages of a pipeline.
What sets a sub-shell apart from a child shell process is that the parent shell's shell variables are available in it. A shell started by running e.g. bash
sets up a new environment, and only environment variables (exported variables) are inherited.
See also:
bsh
which is a shell created in 1984 as the first shell with integrated history editor and not commonly known. – schily Nov 12 '19 at 13:53