How to get shell to self-detect using zsh or bash
If the shell is Zsh, the variable $ZSH_VERSION is defined. Likewise for Bash and $BASH_VERSION. if [ -n “$ZSH_VERSION” ]; then # assume Zsh elif [ -n “$BASH_VERSION” ]; then # assume Bash else # assume something else fi However, these variables only tell you which shell is being used to run the above code. … Read more