title: How to use bc in bash if statement?
body: <p>I am trying to use bc to compare a value with decimals in my if statement.
  I am not sure if I am using bc correctly in my <code>if statement</code> because it doesn't seem to work. It always enters the 4th <code>if statement</code> "<code>IF4</code>". It doesn't seem like the other conditions are being read properly?</p>
  
  <pre><code> #SET INITIAL SPEED
  initialspeed() {
  
  wpm=0
  echo wpm: $wpm
  #CHECKS IF SPEED WAS GIVEN
  if [ -z "$wpm" ]
  then
          let wpm=0.6
          echo IF1 wpm: $wpm #DEBUG
  #CHECK IF SPEED IS VALID
  elif [ 'echo "if$($wpm &gt; 0.6)1;if$($wpm&lt;=0.6)0" | bc' = 1 ]
  then
          echo IF2 wpm: $wpm #DEBUG
          echo Error speed is less than 100 wpm
          exit 3
  elif [ 'echo "if$($wpm &lt; 0.06)1;if$($wpm&lt;=0.06)0" | bc' = 1 ]
  then
          echo IF3 wpm: $wpm #DEBUG
          echo Error speed is more than 1000 wpm
  exit 3
  else
          wpm=$(echo "scale=2;60/$2 | bc")
          echo IF4 wpm: $wpm #DEBUG
  fi
  }
  </code></pre>
  
  <p>EDIT:
  I am actually trying to write a script similar to the "spritz" speed reader. $1 is the file to be read and $2 is the speed that the words will be displayed to the screen. $2 is am optional argument if its not given I set a default speed.</p>
  
  <p>The speed given should be between 100 and 1000 wpm (0.6 and 0.06 before the calculation)</p>