This time, we'll make it easier on you! Follow the given steps:
- Fire up a shell (a Terminal window, typically, on a GUI-based Linux).
- In the window, or more precisely, at the shell prompt, run ps followed by bash —yes, we're spawning a subshell here, followed by ps once more. (Check out the next screenshot; notice the PIDs of the original and sub-shell Bash processes - 3,396 and 13,040.).
- On the sub-shell, exec the ps command; this ps successor process overwrites (or overlays) the process image of the predecessor process—the bash sub-shell.
- Observe the output: In the exec ps command output, the PID of ps is the PID of the bash subshell process: 13,040! This suggests that it's running in the context of that ...