Yes, when you open a terminal window you are starting a shell.
The name of the shell program is stored in the $SHELL
variable. Running simply "$SHELL
" at the command line uses the value in that variable, and then interprets it as a command -- which runs a new shell. When you exit that shell, you return to the shell where it left off.
Sort of like when you're working on something at your desk, and your boss drops some new work on you, so you pause the original work while you do this new thing, and then you can pick up where you left off once you're done with the new task. :-)
This new shell is not a login shell, so it uses a default prompt instead of the prompt specified in your shell login configuration file.
$SHELL
is useful when you need to run a command from within another program. For example, if you're in a text editor and you want to interpolate the output of a shell command, the editor knows which shell program to run by your $SHELL
environment variable.
Rob Kennedy comments about the $SHLVL
variable. This indicates how "deep" you are in shells. For example, when you log in, "echo $SHLVL
" prints 1. If you open a new shell, the same command prints 2. After you quit that subshell and return to your login shell, the command prints 1 again. This is kind of beyond what you were asking, and its uses are more esoteric, but it's kind of interesting.