title: Check if a number is even in shell
body: <p>I need to check if a number is even.</p>
  
  <p>Here's what I've tried.</p>
  
  <pre><code>newY="281"
  eCheck=$(( $newY % 2 ))
  
  echo $newY
  echo $eCheck
  while [ $eCheck -eq 0 ]; do
          newY=$((newY-1))
          eCheck=$(( $newY % 2 ))
          echo $newY
  done
  </code></pre>
  
  <p>...
  returns <code>eCheck = 1</code>
  how can it be? 281/2 = 140.5</p>
  
  <p>i've also tried using <code>bc</code>, but it went into an infinite loop <code>eCheck=$(echo "scale=1;$newY%2" | bc)</code> </p>