title: How to get Bash version number in OS X
body: <p>I am writing a install script which needs Bash 4.x. This install script can be used on OSX too. I am aware that on Linux systems I can get Bash version by checking with <code>echo $BASH_VERSION</code> env variable but how do I get the bash version in Darwin? Running <code>bash --version</code> will give:</p>
  
  <pre><code>GNU bash, version 4.3.33(1)-release (x86_64-apple-darwin14.1.0)
  Copyright (C) 2013 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
  
  This is free software; you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  </code></pre>
  
  <p>This is <em>not</em> the output I want. I want the output to be just the version number, specially just the main version number.</p>