How can I tell what type my shell is? ie, whether it's traditional sh, bash, ksh, csh, zsh etc.
Note that checking $SHELL
or $0
won't work because $SHELL
isn't set by all shells, so if you start in one shell and then start a different one you may still have the old $SHELL
.
$0
only tells you where the shell binary is, but doesn't tell you whether /bin/sh
is a real Bourne shell or bash.
I presume that the answer will be "try some features and see what breaks", so if anyone can point me at a script that does that, that'd be great.
Try to locate the shell path using the current shell PID:
It should work at least with sh, bash and ksh.