title: Chef bash execute not_if some command returns 1
body: <p>I need to checkout code in git repo &amp; do <code>mvn clean package</code> only if code in repo dir contains wrong branch. How can I do this with (or without) not_if in chef recipe?</p>
  
  <pre><code>bash "checkout_and_compile_if_wrong_version" do
    user "develop"
    group "develop"
    cwd "/var/www/"
    environment 'HOME' =&gt; "/home/develop"
    code &lt;&lt;-EOH
              cd /var/www/code_repo/
              git checkout #{node['last_version']}
              git pull
              mvn clean package
    EOH
    not_if { ...condition... }
  end
  </code></pre>
  
  <p>Maybe I can use for a condition something like check (in code_repo dir):</p>
  
  <pre><code>[ "$(git branch |grep "*" |awk '{print $2}')" == #{node['last_version']} ] &amp;&amp; echo 1
  </code></pre>
  
  <p>Thx in advance.</p>