title: syntax error near unexpected token done
body: <p>i keep getting the above error and i can't code it. can someone help check the error please and let me know so i can run it. This is using replacement algorithm. It will be much appreciated if this can be solved. Thank you.</p>
  
  <pre><code>#!/bin/bash
  #
  cnt=0 #page fault
  k=0   #pointer
  pg=(0 0 0 0) #frame_number
  
  IFS=";"","
  
  filecontent=`cat &lt; Input.csv`
  
  array=($filecontent)
  
  echo -e "Page Fault  \tpage 0 \t page 1\t page 2\tpage 3 "
  
  for ((a=0; a&lt;${#array[@]}; ++a))
  
  do
  
      frame[$a]="-"
      usebit[$a]= 0
  
  
  for pg in "${array[$a]}";
  
  do
  
      flag=false
  
  for ((a=0; a&lt;${#array[@]}; ++a));
  
  do
      if [${frame[$b]} = $pg];
  
  then
  
      usebit[$b]=1
      flag=true
      break
  
    fi
  
  done
  
  let check=0
  
  if [ $flag=false];
  
  then
      while ($check -le $array];
  
      if [${usebit[$k]}=1;
  
      then
          usebit[$k]=0
          let "k++"
  
      else
  
          frame[$k]=$pg
          usebit[$k]=1
  
          echo "Page Fault = replace frame $k"
  
          let "cnt++"
          let "k++"
  
      if [$k = $array];
  
      then
  
          k=0
      fi
  
          break;
      fi
  
          if [$k = $array];
  
          then
  
              k=0
  
      fi
  
  
          let "check++"
  
     done
  
     echo -e " $cnt \t\t ${pg[0]}\t ${pg[1]} \t ${pg[2]} \t ${pg[3]} "
     done
  
    echo "The number of page fault for page frame of 4 in clock policy
    algorithm is $cnt"
  </code></pre>