title: trouble debugging a .bash file that separates and echoes either student or student score
body: <p>Like the title implies, I'm currently having trouble debugging a .bash file. As you can tell, I'm still very new to bash and unix in general. Inside The inputfile that hw3.bash executes on contains the following strings in two columns:</p>
  
  <p>jack 80
  mary 95
  michael 60
  jeffrey 90</p>
  
  <p>The file will print out the names only, then scores only, then highest score, then lowest,  then rank, etc. </p>
  
  <p>Both lines 72 and 150 are the hiccups in the program that i cannot seem to debug. Is this a indentation issue or simply a grammatical issue.</p>
  
  <p>line 72: unexpected EOF while looking for matching `''
  line 150: syntax error: unexpected end of file</p>
  
  <pre><code>#1.The first positional argument ($1) provides the file name. Assign it to a
  # variable named inputfile.
  inputfile=$1
  
  #2.Test if the variable inputfile refers to a file. If not, print out a proper
  # message and exit with an exit code of 1.
  if [[ -e inputfile ]]; then
     echo "inputfile is not a file'
     exit 1
  fi
  
  #3.Suppose each line of the input file is made up of the first name of a 
  #student followed by a score (the first name and score are separate by a
  # space). Put the first names in the input file into an array called names.
  record=( $(cat $inputfile | awk 'END{print NR}' ))
  names=( $(cat $inputfile | awk'{print $1}'))
    echo ${names[*]}
  
  
  #4.Using a similar approach, put the corresponding scores into an
  # array called scores.
  scores=( $(cat $inputfile | awk'{print $2}'))
    echo ${scores[*]}
  
  #5.Print names and corresponding scores (i.e. output should look the same as
  # the input file). You must use a loop to do this.
  names=( $(cat $inputfile |  awk'{print $1}'))
    echo${names[*]}
  scores=( $(cat $inputfile | awk'{print $2}'))
  echo${names[*]}
  for((i=0;i&lt;${names[*] &amp;&amp; $i&lt;scores[*];i++))
    do 
     echo{$names[i]} {$scores[*]}
    done
  
  #6.Find the highest scorer, and print the name and the score. You may assume
  #that there is only one highest score.
  maxVal=1
  maxIndex=1
  for(( i=0; i&lt;$#names[*]} &amp;&amp; i&lt;${#scores[*]}; i++ ))
  do
      if [[ (-n ${scores[$i]}) ]]
      then 
  
         if(( ${scores[$i]} &gt; $maxValue ))
         then 
         maxVal=${scores[$i]}
         maxIndex=$i
   fi
      fi
  done
  echo "Highest Scorer:" ${names[$maxIndex]} " " $maxVal
  
  
  #7.Find the lowest scorer, and print the name and the score. You may assume
  #that there is only one lowest score.
  minVal=10000
  maxIndex=1
  for(( i=0; i&lt;${#names[*]} &amp;&amp; i&lt;${#scores[*]}; i++ ))
  do
      if [[ (-n ${scores[$i]}) ]]
      then 
          if(( $minVal &gt; ${scores[i]} ))
          then
             minVal=${scores[$i]}
             minIndex=$i;
          fi
  done
  echo "Lower Scorer:' ${names[$minIndex]} " " $minVal
  
  #8.Calculate the average of all scores, and print it.
  avg=0
  total=0;
  
  for(( i=0;i&lt;${#names[*]} &amp;&amp; i&lt;${$#scores[*]};i++ ))
  do
   if [[ (-n ${scores[$i]} ]]
      then 
          total=$(( $total + ${scores[$i]} ))
      fi
  
  
  
  #9.Sort the arrays in terms of scores (in descending order). The final
  #position of each name in the array names must match with the position of the
  # corresponding score in the array scores.
  
  m=${names[*]}
  n=${scores[*]}
  for(( i=0; i&lt;$n &amp;&amp; i&lt;$m; i++ ))
  do
    maxValue=1
    maxIndex=0
    for(( i=0; j&lt;$n &amp;&amp; j&lt;$m; j++)) 
    do
       if [[ !(-z ${scores[$j]} ) ]]
  then
         if (( $maxVal &lt; ${scores[$j]} ))
         then  
            maxVal=${scores[$j]}
            maxIndex=$j
  
         fi 
       fi
       done
       a1[${#a1[*]}]=$maxVal
  a2[${#a2[*]}]=${names[$maxIndex]}
       unset scores[$maxIndex]
    done
  
   for(( i=0; j&lt;${#a2[*]} &amp;&amp; i &lt; ${#a1[*]; i++ ))
  do
   echo ${a2[i]} ${a1[i]}
  done
  
  #10.Print sorted names and scores. Put the rank of each student before the
  m=${#names[*]}
  n=${#scores[*]}
  for (( i=0; i&lt;$n &amp;&amp; i&lt;$m; i++ ))
  do 
  maxVal=1
  maxIndex=0
  for (( j=0: j&lt;$n &amp;&amp; j&lt;$m; j++ ))
  do
    if [[ !_-z ${scores[$j]}) ]]
    then 
      if (( $maxVal &lt; ${scores[$j]}
      maxIndex=$j
      fi 
    fi
    done
  a1[${#a1[*]}]=$maxVal
  a2[${#a2[*]}=${names[$maxIndex]}
  unset scores[$maxIndex]
  done
  k=1 
  while [[ $k -lt ${#a2[*]} ]]
  do
    for(( i=0;i &lt; ${#a2[*]} &amp;&amp; i &lt; ${#a1[*]};i++ ))
    do
  
      echo "Ranking" $k "is:" ${a2[i]}
      k=$(($k+1))
    done
  done
  </code></pre>