Hello,
I am attaching a code snippet. Some of the variables are set in earlier code like count, arrays harr1, harr2, barr1 and barr2. The code below gives syntax errors. I am very new to Bash.
for (( i=0; i<=$(( $count -1 )); i++ ))
do
#Now read the element at barr2 location i. Also find element at barr1 at position i. Now find the position of this element in harr1. The second value we will get by reading harr2 at this position.
first=$barr2[$i]
search = $barr1[$i]
for (( j=0; j<=5000; j++ ))
do
if [ harr1[$j] -eq $search ]; then
break;
fi
done
second = $harr2[$j]
echo $second
done
The error generated is in the if statement. The error says:
unary operator expected
Appreciate your help.
Thanks