title: Bash File Line Count Comparing to Integer Incorrectly
body: <p>I have a simple bash script where I'm trying to iterate over the lines in a text file and calculate different metrics (moving average, derivative, etc). I'm having some trouble comparing the index iterator with the total line count and is producing some unexpected results.</p>
  <pre><code>input=&quot;sample.txt&quot;
  lines= wc -l &lt; $input # 14
  x=1
  [[ ${x} -lt ${lines} ]] &amp;&amp; echo &quot;true&quot; || echo &quot;false&quot;
  </code></pre>
  <p>^This Returns False (when comparing 1 &lt; 14 )</p>
  <p>Therefore this while loop doesn't run:</p>
  <pre><code>while [[ ${x} -lt ${lines} ]]
  do
    echo &quot;Welcome $x times&quot;
    read p
    echo $p
    x=$(( $x + 1 ))
  done &lt; $input
  </code></pre>