Create array

# Three elements
array=( One Two Three )
# Two elements
array=( "One Two" Three )
# All tar.gz files in current directory
archives=( *.tar.gz )
# Two elements at indexes 5 and 6
array[5]=Five; array[6]=Six

Create associative array

declare -A dict=( ["name"]=Alex ["nick"]=gonzo )

Append array

# Add all zip archives in current directory to $archives
archives+=( *.zip )

Read array from stdin separated by whitespaces

# For input line 'One     Two Three' array would be (One, Two, Three)
read -ra array

Split string into array

IFS=, read -ra array <<< "One,Two,Three"

Access array

# First element

# Associative array

Join array using string

array=( One Two Three )
# str is "One,Two,Three
str=$(IFS=,; echo "${array[*]}")

Iterate over all keys of the array

for key in "${!person[@]}"; do echo "$key is ${person[$key]}"; done

Iterate over all elements of the array

array=( One Two Three )
for el in "${array[@]}"; do
    echo "$el"

Read lines from the file into array

while read line; do
done < file.txt