title: Comparing integers and decimals in bash
body: <p>I am trying to compare two numbers stored in variables in a shell script. The objective is to find if the incoming value is inside the specified ranges: <code>500-600</code> or <code>700-800</code>. </p>
  
  <p>My current code looks like:</p>
  
  <pre><code>inc=0
  srange[0]=500 
  erange[0]=600
  srange[1]=700 
  erange[1]=800
  
  for i in "${startrange[@]}"; do
      if [[ " ${startrange[$inc]} " -lt " $actual " ]]; then
          echo " in range "
      fi
      inc = $((inc+1))
  done
  </code></pre>
  
  <p>The code works with integer values such as <code>530</code> or <code>540</code> but fails with decimal values like <code>530.2</code> or <code>540.3</code>, resulting in a syntax error on this line of the code:</p>
  
  <pre><code> if (( " ${startrange[$inc]} " -lt " $actual " )); then
  </code></pre>
  
  <p>How can I fix this to handle the decimal values?</p>