e.g. I use
ssh to login into a Linux server with
zsh. Then in the
zsh, I type
zsh to get a non-login shell. How can I quit the non-login
zsh and get back to the login
That will only exit the most recent shell, not the remote server, unless you're in the login shell.
You can see if you're in a login shell by echoing
$SHLVL. It will have value
1 if you're in your login shell but will be
2 when you start a subsequent shell.
$0 might also be set to
-zsh in the login shell but
zsh in others.