why double brackets for array loop?

Dear All,

Recently got some sample from internet search for array handle in shell script, and I can not understand why we need to put double brackets when extracting array values by this way :

for ((i=0; i<${#admins[@]}; i++)); do
echo "${admins[$i]}"
done

if modify from double to single bracket in for loop, I got this error:

syntax error near unexpected token `('
`for (i=0; i<${#admins[@]}; i++); do'

can someone advise why ?? Thanks in advance.
Rgds,
kevin

maybe some special character it cannot understand ( without ((. You must pad it

sometime back I had similar problem using square brackets, a forumer here advised to use [[ instead of [ and it solved the problem

Hi.

Because

for (( ...

is the syntax for that statement.

The meaning of single and double parentheses is different. See man ksh or man bash ... cheers, drl