SHELL environment variable keeps returning the value of default shell

bashenvironment-variableslinuxshell

I'm using a terminal emulator with bash as the default shell ,then printed the value of the environment variable SHELL to print the current shell and it did , but when i enter another shell i.e., zshell , it keep returning the first value of the default one .

How to get it to print out the value of the current shell i'm residing at ?

$ echo $SHELL 
/bin/bash

$ zsh 
unixnode% 

$ unixnode% echo $SHELL 
/bin/bash

Best Answer

When you're logged in with a login-in shell , the shell variable gets assigned to that shell .
Whenever you used a non-login shell such as like simply running the zsh from within the current login shell session , the value of the variable Shell will remain the same , yet if you want to have it changed to the other shell then you'll have to log-out and login back again into the other shell .

Related Question