~/ learn/ comp-325/ cards/ Shells: which one you are in, and how to leave it
1 of 7

Stack a shell, see both, and come back out

Stack a shell, see both, and come back out

Answer

echo $SHELL ps -o pid,comm sh ps -o pid,comm exit

The second `ps` shows one more shell than the first: running a shell by name adds a child process, it does not replace the one you were in. `exit` (or Ctrl-D on an empty line) pops exactly one level.

Sarwar & Koretsky 3e ch2 §2.7–2.8

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/e3e1afe9-7d76-4986-bf7e-cb2384665a70/flashcard utf-8 LF