To get just the name of the shell, e.g. bash
or zsh
, use
echo $SHELL | rev | cut -d/ -f1 | rev
Example:
$ echo $SHELL | rev | cut -d/ -f1 | rev bash
To get the full path of the current shell executable, use
echo $SHELL
Example:
$ echo $SHELL /bin/zsh