title: How to Do a For Loop Instead of a While Loop in Shell Scripting
body: <p>I'm trying to implement for loops instead of while loops but have no idea how too. This is a while loop script I created. How would I make this into a for loop instead of a while loop? I'm not really understanding how for loops work.</p>
  
  <p><pre><code>#!/bin/bash</p>
  
  <p>read -p "Number of Papers To Grade:
  " numpap</p>
  
  <p>av=$numpap
  while [ $av -gt 0 ];
  do
    av=$(($av - 1))
    echo "Enter a Number (1-100): "
  read num
  if [[ $num -ge 1 &amp;&amp; $num -le 100 ]] ; then
       echo ""
     else
       echo "Enter a Number Between 1-100
       "
       av=$(($av + 1))
       total=$(($total - num))
     fi
  total=$(($total + num))
  done
  averag=$(($total/$numpap))
  echo Average Grade = $averag%
  echo "Done"
  </pre></code></p>