title: syntax error: invalid arithmetic operator (error token is "")
body: <p>I am trying to write a function the checks a text file, line by line, checking each field by certain cretirias, and then sums it all up. I am using the exact same way to sum each one of cretirias, but for the 4th one (in the code it will be time) I get the error in the title. I tried removing the line that sums the time and my code worked just fine, I have no clue what's wrong with the line and I'm pretty new to Bash. Every bit of help will be appreciated!</p>
  
  <p>Here's the code:</p>
  
  <pre><code>#!/bin/bash
  valid=1
  sumPrice=0
  sumCalories=0
  veganCheck=0
  sumTime=0
  function checkValidrecipe
  {
      while read -a line; do
          if (( ${line[1]} &gt; 100 )); then
              let valid=0
          fi
          if (( ${line[2]} &gt; 300 )); then
              let valid=0
          fi
          if (( ${line[3]} != 1 &amp;&amp; ${line[3]} != 0 )); then
              let valid=0
          fi
          if (( ${line[3]} == 1)); then
              veganCheck=1
          fi
          let sumPrice+=${line[1]}
          let sumCalories+=${line[2]}
          let sumTime+=${line[4]}
      done &lt; "$1"
  }
  checkValidrecipe "$1"
  if (($valid == 0)); then
      echo Invalid
  else
      echo Total: $sumPrice $sumCalories $veganCheck $sumTime
  fi
  </code></pre>
  
  <p>And I can assume that every input file will be in the following format:</p>
  
  <pre><code>name price calories vegancheck time
  </code></pre>
  
  <p>I am trying to run the script with this input file:</p>
  
  <pre><code>t1 50 30 0 10
  t2 10 35 0 10
  t3 75 60 1 60
  t4 35 31 0 100
  t5 100 30 0 100
  </code></pre>
  
  <p>(Blank line included)</p>
  
  <p>And here's the output:</p>
  
  <pre><code>")syntax error: invalid arithmetic operator (error token is "
  ")syntax error: invalid arithmetic operator (error token is "
  ")syntax error: invalid arithmetic operator (error token is "
  ")syntax error: invalid arithmetic operator (error token is "
  ")syntax error: invalid arithmetic operator (error token is "
  Total: 270 186 1 0
  </code></pre>
  
  <p>Thank you very much for your help!</p>