How do I know if I am running a shell inside another shell?
Answer:
We can enter another a shell from a current shell, e.g. enter sh from a bash. To show the current "shell stack", you can use the pstree command.
# pstree -p | grep bash
|-sshd(791)---sshd(29118)---sshd(29171)---bash(29172)---sh(29428)-+-grep(29430)