Detect Bash, zsh or other shell
A 5-way shell detect script can detect bash, csh, dash, ksh, or zsh. However, often we simply want to detect if the shell is Bash or something else. For example, in a Bash-dependent script we may thereby stop and recommend the user use Bash to avoid needing to test across numerous shells. There are a number of pitfalls in detecting a shell type so this method is not completely robust either, but has worked. The key to this technique is that while different shells have distinct “if-else” syntax, most shells have “case-esac”.