I am using 'zsh' by default.
But when I am in my zsh shell, I enter 'bash' to switch to bash, why the $SHELL variable does not change?
Can I make screen to use whatever shell I right before execute the 'screen' command?
zsh % screen
<the shell is zsh>
zsh % bash
bash $ screen
<the shell is still bash, can I make screen to automatically start bash here>
The SHELL variable (along with some other variables, such as HOME and USER) is set by the process that logs you in. It is set to the login shell value set in the passwd database (/etc/passwd). It is not meant to reflect the shell you're currently using.
screen uses the SHELL variable to determine what shell to run inside the screen, so you can override that by running e.g.
And if you want bash to be your login shell instead of zsh, you can run the
chsh
(change shell) command as your user.