title: Comparing variable to string in Bash
body: <p>I've tried the suggestion at <a href="https://stackoverflow.com/questions/4277665/how-do-i-compare-two-string-variables-in-an-if-statement-in-bash">How do I compare two string variables in an &#39;if&#39; statement in Bash?</a></p>
  
  <p>but it's not working for me.  </p>
  
  <p>I have </p>
  
  <pre><code>if [ "$line" == "HTTP/1.1 405 Method Not Allowed" ]
  then
      &lt;do whatever I need here&gt;
  else
      &lt;do something else&gt;
  fi
  </code></pre>
  
  <p>No matter what, it always goes to else statement.  I am even echoing $line ahead of this, and then copied and pasted the result, just to be sure the string was right.  </p>
  
  <p>Any help on why this is happening would be greatly appreciated. </p>