title: declare array in bash script errors out: bad array subscript
body: <p>I'm trying to debug my script, I'm new at bash and I can't understand the error.
  i tried to change it several times and warped line 60 with comments.</p>
  <p>the error:</p>
  <blockquote>
  <p>error: ./scriptdemo.txt: line 60: results_array: bad array subscript</p>
  </blockquote>
  <pre><code>#!/bin/bash
  
  echo the script is running
  
  #this part uses preCourses script to get preCourse demends for the input 
  course
  results_array=''
  reqursion_counter=-2
  result_courses_counter=0
     ----------------------
     ....some more logic...
     ----------------------
  results_array[$result_courses_counter]=${line_of_course[$len-$k-1]}
  let result_courses_counter++
  
     ----------------------
     ....some more logic...
     ----------------------  
  </code></pre>