title: Comparing an integer variable in the Bash shell
body: <p>I know I'm missing something very obvious, but I just can't see it. In the code below, <code>new_i</code> variable gets incremented properly, however, when I get to the <code>if</code> statement, I think my syntax is off. I looked at some examples, but none show variable set to zero when <code>if</code> statement is greater than (in this case <code>15</code>) a number.</p>
  
  <pre><code>#!/bin/sh
  i=$(cat /etc/hour.conf)
  new_i=$((i+1))
  if [[ "$new_i" -gt 15 ]]; then
   new_i=0
  fi
  echo "$new_i"&gt;/etc/hour.conf
  echo "$new_i"
  </code></pre>
  
  <p>When I run this script I get the following error:</p>
  
  <pre><code>./loops: 3: ./loops: Illegal number: new_i
  </code></pre>
  
  <p>Thanks in advance for your help!</p>