Modulus function in bash shell script
<pre><code>for ((i=0; i&lt;lenPT; i++)) do 
    if [[ $(($lenPT % 2))  == 0]] then
        P[i] = "$((K [0] * arrT[i] + K[2] * arrT[i+1]))" 
    else
        P[i] = "$((K[1]*arrT[i-1]+K[3]*arrT[i]))"
    fi
done
</code></pre>

<p>I got errors saying that <em>"syntax error in conditional expression"</em> and <em>"syntax error near 'then'"</em>.  What is the error in my conditional statement?</p>