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
0

1 Answer 1

4

Remove the colon exists after do

$ categories=("men" "women" "kids")
$ for i in "${categories[@]}";do echo $i;done
men
women
kids
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.