# How to loop over an array in Bash

> Learn how to loop over an array in Bash using a for loop and the ${list[@]} syntax to iterate over every element and echo each one in turn.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2022-05-10 | Topics: [CLI](https://flaviocopes.com/tags/cli/) | Canonical: https://flaviocopes.com/bash-loop-array/

I had an array of 3 strings:

```
list=( "first" "second" "third" )
```

and I wanted to loop over them in a [bash shell script](https://flaviocopes.com/bash-scripting/).

Here's how I did it:

```sh
for i in "${list[@]}"
do
   : 
   echo $i
done
```
