Arrays

An array keeps a list in numbered slots, counted from 0: songs=("Highway Tea" "Window Down") makes one, ${songs[0]} reads a slot, ${#songs[@]} counts the items, songs+=( ) adds one, "${songs[@]}" hands on every item in one piece, and mapfile -t fills an array from a file's lines.

Updated

Cheat sheet for the lesson Arrays: An array keeps a list in numbered slots, counted from 0: songs=("Highway Tea" "Window Down") makes one, ${songs[0]} reads a slot, ${#songs[@]} counts the items, songs+=( ) adds one, "${songs[@]}" hands on every item in one piece, and mapfile -t fills an array…
Category
Bash
Level
Journeyman
Tags
Array, array-index, linux, mapfile, random, unix, word-splitting