title: How to parse the error given by a bash script?
body: <p>Given this script:</p>
  <pre><code>#!/bin/bash
  COMMAND=$(echo test | jq)
  if [[ $COMMAND == *&quot;error&quot;* ]]; then
          echo failed
          else
          echo success
  fi
  </code></pre>
  <p>Since the output of <code>$(COMMAND)</code> is the following: <code>parse error: Invalid literal at line 2, column 0</code>, I'd expect to have as output of that script <code>failed</code>, but I'm having <code>success</code>.</p>
  <p>How can I parse the error that I got on scripts?</p>