Shell Script error: command not found
<p>Here is my code aiming to diff .in and .out file in batches. Both .in and .out files are in same directory and sorted by name. So, two files needed to test should be adjacent in directory. But when I want to use <code>outFile=${arr[$(i++)]}</code> to get the .out file, it shows <code>i++: command not found</code>. What's the error in my script?</p>

<pre><code>#!/bin/sh

dir=$PATH
arr=($dir/*)

for((i=0;i&lt;${#arr[@]};i++));do
        inFile=${arr[$i]}
        outFile=${arr[$(i++)]}
        if diff $inFile $outFile &gt; /dev/null; then
                echo Same
        else
                echo $inFile
        fi
done
</code></pre>