On Jan 10, 2008 8:13 AM, Frans de Boer <[EMAIL PROTECTED]> wrote: > Following is a function which fails constantly. [...] > if [[ $i != -1 && $i < $((iPriTblCnt-1)) ]]; then > echo $((i+1)); > else > echo -1 > fi
Now, "[[" isn't very well documented, so I tend not to use it, but notice how "<" behaves here. It looks like it's doing a string comparison. Try "-lt" to get a numeric less-than. > ------ Example trace 1 -> [...] > ++ [[ 5 < 54 ]] > ++ echo 6 [...] > ++ [[ 6 < 54 ]] > ++ echo -1 [...] > ------------- Example trace 2 -> [...] > ++ [[ 1 < 109 ]] > ++ echo 2 [...] > ++ [[ 2 < 109 ]] > ++ echo -1 Regards, Dave