Bash – Why does $SHELL point to /bin/bash if running zsh inside bash

bashenvironment-variablesshellzsh

If I run zsh inside bash (on macOS Sierra), why does $SHELL still point to /bin/bash, rather then /bin/zsh?

$ echo $SHELL
/bin/bash
$ zsh
% echo $SHELL
/bin/bash

Best Answer

$SHELL should point to your login shell, not current shell. As in, grep $USER /etc/passwd - it shows you your login shell which is probably /bin/bash.

You need to change shell with chsh to make the change permanent.

Related Topic