I have written some script in bash but it won't work. Can anybody help me with this. I am providing the script here:
#!/bin/bash
declare -a array=("red" "blue" "green" "yellow")
for (( i=0; i<${array[@]}; i++));
do
echo "items: $i"
done
I want to iterate through the array. Coz when ever I do it I'm getting an error saying:: arr1.sh: 2: Syntax error: "(" unexpected