title: Script terminates when storing grep -c output when value is 0
body: <p>I am trying to check if a file has CR line feed and store the result 0 or 1 into a variable.</p>
  
  <p>Here is my command that runs inside a script.</p>
  
  <pre><code>isCR="$(file ${fileName} | grep -c 'with CR line terminators')"
  </code></pre>
  
  <p>The script runs until the previous line and doesn't run this line but terminates abruptly.</p>
  
  <p>Inside an echo statement it works perfectly. </p>
  
  <pre><code>echo "isCR=$(file ${fileName} | grep -c 'with CR line terminators')"
  </code></pre>
  
  <p>This prints isCR=0 or isCR=1 depending on the file I use.</p>
  
  <p>But just storing the value into variable isCR doesn't work. I am confused what am i missing here. Any help is appreciated.</p>