title: What is wrong with my guessing game program?
body: <p>So yes I am doing this for school but I have most of the script written. I don't know what's going on with it, maybe a syntax error but it keeps messing up(or I do).</p>
  
  <p>The first issue is that it keeps posting the number that you are trying to guess and it says no file or directory(I didn't think I was calling for such things). The 86 is the current random number.</p>
  
  <pre><code>./random: line 14: 86: No such file or directory
  </code></pre>
  
  <p>The second issue is that the program is telling me guesses are always too low(I can also get them to always be too high)</p>
  
  <pre><code> I'm thinking of a number between 1 and 100. Your guess:6
  
  ./random: line 14: 86: No such file or directory
  Sorry, your guess is too low. New guess:87
  
  ./random: line 14: 86: No such file or directory
  Sorry, your guess is too low. New guess:
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>#!/bin/bash
  
  
  n1=$[($RANDOM % 100) +1]
  guesses=1
  echo -n "I'm thinking of a number between 1 and 100. Your guess:"
  
  while read n2; do
  
  if   [ $n2 = $n1 ]; then
  break;  
  else
  echo    
  if [ $n2 &lt; $n1 ]; then 
  echo -n "Sorry, your guess is too high. New guess:"
  elif [ $n2 &gt; $n1]; then
  echo -n "Sorry, your guess is too low. New guess:"
  fi      
  fi
  guesses=$((guesses+1))
  
  done
  echo
  echo "Good job! It took you $guesses guesses to get the right number."
  </code></pre>
  
  <p>Thanks in advance.</p>