I\'ve a question on how to tell which shell the user is using. Suppose a script that if the user is using zsh, then put PATH to his .zshrc and if using bash sho
.zshrc
the other answers fail with set -u
set -u
if [ ! -z ${ZSH_VERSION+x} ]; then echo "this is zsh" echo ${(%):-%x} elif [ ! -z ${BASH_VERSION+x} ]; then echo "this is bash" echo $BASH_SOURCE else echo "not recognized" fi