I have recently upgraded from Catlina to Big Sur and changed shell to zsh but when I echo $SHELL it still shows /bin/bash how do I change this
CodePudding user response:
I would either put a
SHELL==zsh
or
SHELL=$0:a
into your ~/.zshenv
(the difference between these two forms is explained below). This has several advantages:
This file is only processed by zsh, interactive and non-interactive, so there is no risk that this setting is picked up by a different shell.
By setting it as a shell variable and not an environment variable, child processes written in different shells (bash, ksh, sh, ...) can set the
SHELL
variable by themselves, if they like.By using the form
=zsh
, zsh expands the word zsh to the full path of the shell. This assumes that zsh is in your PATH, which is reasonable anyway.If you decide to go for the alternatie form,
$0:a
, instead of=zsh
, you are assigning toSHELL
the path of the current zsh. This makes a difference, if you have several zsh versions installed on your system, and want to make sure thatSHELL
is set to the one which is currently running.