How to get shell to self-detect using zsh or bash
问题 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 should put in .bashrc. And set rvmrc accordingly. #!/usr/bin/env bash export PATH='/usr/local/bin:$PATH'" >> ~/.zshrc source ~/.zshrc I've tried the following but it does not work : ( if [[ $0 == "bash ]]; then export PATH='/usr/local/bin:$PATH'" >> ~/.bashrc elif [[ $0 == "zsh" ]]; then export PATH='/usr/local/bin:$PATH'" >> ~/.zshrc fi #