title: HOWTO: Detect bash from shell script
body: <p>The scenario is that users are asked to source a script file:</p>
  
  <pre><code>$ source envsetup.sh
  </code></pre>
  
  <p>This script file may use bash only feature so we have detect the running shell is bash or not.</p>
  
  <p>For other shells that share common syntax with bash, for example, sh, zsh, ksh, I'd like to report a warning.</p>
  
  <p>What is the most reliable way to detect the current shell across Linux, Cygwin, OS X?</p>
  
  <p>What I know is $BASH, but I am wondering the chances it could fail.</p>