0

Which of the following commands created a bash subshell?

  1. bash
  2. bsh
  3. csh
  4. None of the above

This question asked in recent exam and i was unable to answer. Can any one give me right answer?

muru
  • 72,889
  • 1
    It is strange that they asked for 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

1 Answers1

1

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:

Kusalananda
  • 333,661