i have three arrays A, B, C. Array A-B values are being parsed from file and i want them to add up into array C.
#!/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 < ~/file
exit 0
what is wrong with that assignment?
complete line from script:
hitEnd[i]=`expr ${hitLength[i]}+${hitStart[i]}`
echo "${hitEnd[i]}"
#no output
echoit outputs the correct values, but at the error output there is no value shown for array A's value..