I have to a perform logic like this. I have a array. expression for this in shell
[(first no + arrlen) - ( index +1 ) - ge 10 ]
I have code this like this but it's not working
#!/bin/bash
array=(4 5 6 7 8 9)
for i in ${array[@]}
do
echo $i
done
echo "${#array[@]}"
l=${#array[@]}
count=0
for (( i=0; i < ${#array[@]}; i++ ))
do
if [ ($(`expr $i + $l`) - $(`expr ${!array[@]} + 1`)) -ge 10 ]
then
count=`expr $count + 1`
else
echo
fi
done
expr $i + $l) - $(expr ${!array[@]} + 1))) -ge 10 ]