Terminal.app: changing shell behavior problem?
The following information is taken from


SHELL environment variable still points to zsh after using bash and
What sets the $SHELL environment variable?


on Unix &amp; Linux, which applies to macOS as well.

You are running the Korn shell if the Terminal preference is set to /bin/ksh. The output 

$ echo $SHELL
/bin/bash


is misleading because the SHELL variable is set by the login process to


  The user's shell, as specified by the password database.


(On macOS it is a user database and not the /etc/passwd file as on Linux, where that information is stored, but that does not matter.)

You can type

$ echo $0
-ksh


or

$ echo $KSH_VERSION
Version AJM 93u+ 2012-08-01


to verify that you are running the Korn shell.

Setting the shell via  

$ chsh -s /bin/ksh


sets the login shell in the user database, and then SHELL is set accordingly:

$ echo $SHELL
/bin/ksh