0

following is my test code to traverse though elements placed in an array. However I am getting the specified error. Please help me understand what the error is, and why I am getting it, so that I can rectify my mistake.

Code:

#!/bin/bash
categories=("men" "women" "kids")

for i in "${categories[@]}"
   do:
       echo $i;

   done
Quicksillver
  • 197
  • 4
  • 17

1 Answers1

4

Remove the colon exists after do

$ categories=("men" "women" "kids")
$ for i in "${categories[@]}";do echo $i;done
men
women
kids
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274