title: operand expected (error token is “+ ”): Bash error when adding array element value to numerical variable
body: <p>I have been working on a bash script to generate a script for duplicating a database on a different (auxiliary) server.</p>
  
  <p>There are 6 locations on the auxiliary host where the files will be stored (hence the for loop <code>0 &gt;= i &gt;=5</code>).</p>
  
  <p>The scripts main purpose is to check that the auxiliary host's locations have enough space to accommodate the files which will be copied across.</p>
  
  <ul>
  <li><code>aux_dest_space</code> is space available on mounted locations on auxiliary host; where the files are to be stored (array).</li>
  <li><code>temp_space</code> is file size(s) (cumulative); in order for the copy process to stop once aux_dest_space is full.</li>
  <li><code>df_size</code> is file size (stored in array) </li>
  </ul>
  
  <p><strong>Error Message:</strong></p>
  
  <pre><code>./script.sh: line 108: 472879112 +  : syntax error: operand expected (error token is "+  ")
  temp_space=$(( $temp_space + ${df_size[${k}]} ))  
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>for (( i=0; i&lt;=5; i++ ))
  do
        while [ ${aux_dest_space[${i}]} -gt $temp_space ]
        do
            .
            .
            .
            .
             k=$((k+1))
             temp_space=$(( $temp_space + ${df_size[${k}]} )) # (line 108 - error)
         done
         temp_space=${df_size[${k}]}
   done
  </code></pre>