Please someone explain me
I know what i will get by executing this. got this from a website.
But I dont understand how line 3 work.
As well as the for loop required 2 first bracket "((...))".
If I use one first bracket "(..)" it generates error.
Can anyone explain these for me?
Best regards,
Johny
Code:
#!/bin/bash
ARRAY=("example program" "for test only" "Lets try");
ELEMENTS=${#ARRAY[@]};
echo $ELEMENTS;
for((i=0;i<$ELEMENTS;i++));do
echo ${ARRAY[$i]} # echo ${ARRAY[${i}]}
done
But I dont understand how line 3 work.
As well as the for loop required 2 first bracket "((...))".
If I use one first bracket "(..)" it generates error.
Can anyone explain these for me?
Best regards,
Johny
Comment