title: How do I use a variable in another if statement in a Bash script?
body: <p>So let's say, I have an if statement that looks like this:</p>
  <pre><code>if [[ $line == *'&lt;=='* ]]; then
     VARIABLE=&quot;${line%%&lt;==*}&quot;
     OBJECT=&quot;${line#*&lt;==}&quot;
     echo $VARIABLE
     echo $OBJECT
  fi
  </code></pre>
  <p>I need to create an if statement that uses the variable object from that last if statement, however when I add this to the code:</p>
  <pre><code>if [[ $line == $VARIABLE ]]; then
     echo $OBJECT
  fi
  </code></pre>
  <p>Full code:</p>
  <pre><code>line=&quot;greeting &lt;== hi&quot;
  
  if [[ $line == *'&lt;=='* ]]; then
     VARIABLE=&quot;${line%%&lt;==*}&quot;
     OBJECT=&quot;${line#*&lt;==}&quot;
  elif [[ $line == $VARIABLE ]]; then
     echo $OBJECT
  fi
  </code></pre>
  <p>It does absolutely nothing at all. How can I fix this?</p>