title: Bash- add up two arrays variables' to third array's variable
body: <p>i have three <code>arrays A, B, C</code>. Array A-B values are being parsed from file and i want them to add up into <code>array C</code>.   </p>
  
  <pre><code>#!/bin/bash
  i=0
  A=()
  B=()
  C=()
  while read line
  do
    A[i]="$(echo $line| cut -d\  -f4)"
    B[i]="$(echo $line| cut -d\  -f11)"
    echo ${A[i]} " and " ${B[i]}
    # outputs correct values
    C[i]=`expr ${A[i]} + ${B[i]}`
    echo ${C[i]} 
    # no output
    i=$((i+1))
  done &lt; ~/file
  exit 0
  </code></pre>
  
  <p>what is wrong with that assignment?</p>
  
  <p>complete line from script:</p>
  
  <pre><code>hitEnd[i]=`expr ${hitLength[i]}+${hitStart[i]}`
  echo "${hitEnd[i]}"
  #no output
  </code></pre>