# Array

*noun*

say it: **“uh-RAY”** **/əˈreɪ/**

A variable that keeps a list of values in numbered slots, counted from 0, so each item stays whole and can be read by its number.

## What is an **array** in bash?

An **array** keeps a list in one variable, each item in a numbered slot counted from 0. `${songs[0]}` reads one item, `${#songs[@]}` counts them, and `"${songs[@]}"`, in double quotes, is every item, each title in one piece.

```bash
songs=("Highway Tea" "Paper Lanterns" "Window Down")
echo "${songs[0]}"     # Highway Tea
echo "${#songs[@]}"    # 3
for song in "${songs[@]}"; do echo "Now playing: $song"; done
# Now playing: Highway Tea   (then the other two, one a line)
```

## In a sentence

- “The shuffler keeps every song title in an **array** called songs.”
- “Each title in the **array** stays in one piece, spaces and all, when the loop reads it.”

Level: Journeyman · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=3)

Updated: November 10, 2026

## In other subjects

- [Array in C#](https://www.ask-codey.com/glossary/array-c-sharp)
- [Array in Data Structures](https://www.ask-codey.com/glossary/array-data-structures)
- [Array in Java](https://www.ask-codey.com/glossary/array)
- [Array in JavaScript](https://www.ask-codey.com/glossary/array-javascript-2)
- [Array in PowerShell](https://www.ask-codey.com/glossary/array-powershell)

Source: https://www.ask-codey.com/glossary/array-unix
