title: How to get shell to self-detect using zsh or bash
body: <p>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 <code>.zshrc</code> and if using bash should put in .bashrc. And set rvmrc accordingly.</p>
  
  <pre><code>#!/usr/bin/env bash
  export PATH='/usr/local/bin:$PATH' &gt;&gt; ~/.zshrc
  source ~/.zshrc
  </code></pre>
  
  <p>I've tried the following but it does not work : (</p>
  
  <pre><code>if [[ $0 == "bash" ]]; then
    export PATH='/usr/local/bin:$PATH' &gt;&gt; ~/.bashrc
  elif [[ $0 == "zsh" ]]; then
    export PATH='/usr/local/bin:$PATH' &gt;&gt; ~/.zshrc
  fi
  
  # ... more commands ...
  
  if [[ $0 == "bash" ]]; then
    [[ -s '/Users/`whoami`/.rvm/scripts/rvm' ]] &amp;&amp; source '/Users/`whoami`/.rvm/scripts/rvm' &gt;&gt; ~/.bashrc
    source ~/.bashrc
  elif [[ $0 == "zsh" ]]; then
    [[ -s '/Users/`whoami`/.rvm/scripts/rvm' ]] &amp;&amp; source '/Users/`whoami`/.rvm/scripts/rvm' &gt;&gt; ~/.zshrc
    source ~/.zshrc
  fi
  </code></pre>