title: Bash - If statement performing empty comparision
body: <p>I know this sounds silly, but had a rough start in this week and i'm not able to think clearly.</p>
  <p>I'm writing this simple piece of code, which is suppose to get little complex later on. However I'm stuck near this simple If condition statement.</p>
  <p>I wrote the code in VS on my host Ubuntu, copied it to a file inside a docker container and executed it.</p>
  <p>As you see, the left side of the IF condition is taken as a null value for comparision. Where am i going wrong ?</p>
  <pre><code>#!/bin/bash
  
  someEquation()
  {
      cluster_state=`src/redis-cli -h 127.0.0.1 -p 36000 cluster info | grep cluster_state | awk -F':' '{print$2}'`
      if [[ &quot; ${cluster_state} &quot; == &quot;fail&quot; ]]; then
          echo &quot;arr contains fail&quot;
      fi
  }
  
  someEquation
  </code></pre>
  <p>Output:</p>
  <pre><code>+ someEquation
  ++ src/redis-cli -h 127.0.0.1 -p 36000 cluster info
  ++ grep cluster_state
  ++ awk -F: '{print$2}'
  + cluster_state=$'fail\r'
    == \f\a\i\l ]]
  </code></pre>