title: Why is my bash string comparison of two identical strings always false?
body: <p>I'm trying to write a simple little script to query a 3g connection, and if the connection has dropped, instigate a reconnection.</p>
  
  <p>My problem is in checking the output of the command - two seemingly equal strings are not evaluated as equal. I'm sure there's a noob error in here somewhere!</p>
  
  <pre><code>#!/bin/bash
  
  echo "Checking connection"
  a="Not connected."
  b=$(./sakis3g status --console)
  
  if [[ "$a"!="$b" ]]; then 
      echo "Strings not equal:"
      echo "$a"
      echo "$b"
  else 
      echo "Strings equal!!"
  fi
  </code></pre>
  
  <p>The output when run:</p>
  
  <pre><code>user@mypc:~$ ./test_3g.sh 
  Checking connection
  Strings not equal:
  Not connected.
  Not connected.
  </code></pre>
  
  <p>When running <code>./test_3g.sh | cat -A</code>:</p>
  
  <pre><code>user@mypc:~$ ./test_3g.sh | cat -A
  Checking connection$
  Strings not equal:$
  Not connected.$
  Not connected.$
  </code></pre>