title: How can I check for software versions in a shell script?
body: <p>I have two software version checks in my bash script that don't work as I would have expected.</p>
  
  <pre><code>DRUSH_VERSION="$(drush --version)"
  echo ${DRUSH_VERSION}
  if [[ "$DRUSH_VERSION" == "Drush Version"* ]]; then
      echo "Drush is installed"
    else
      echo "Drush is NOT installed"
  fi
  GIT_VERSION="$(git --version)"
  echo ${GIT_VERSION}
  if [[ "GIT_VERSION" == "git version"* ]]; then
      echo "Git is installed"
    else
      echo "Git is NOT installed"
  fi
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>Drush Version : 6.3.0
  Drush is NOT installed
  git version 1.8.5.2 (Apple Git-48)
  Git is NOT installed
  </code></pre>
  
  <p>Meanwhile, if I change </p>
  
  <blockquote>
    <p>DRUSH_VERSION="${drush --version)"</p>
  </blockquote>
  
  <p>to </p>
  
  <blockquote>
    <p>DRUSH_VERSION="Drush Version : 6.3.0"</p>
  </blockquote>
  
  <p>it responds with </p>
  
  <blockquote>
    <p>Drush is installed</p>
  </blockquote>
  
  <p>For now I will use </p>
  
  <blockquote>
    <p>if type -p drush;</p>
  </blockquote>
  
  <p>but I would still like to get the version number.</p>