parameter-expansion

Bash array indices with *

Joins assigned indices or keys into one word using the first IFS character when double-quoted.

Formal Syntax & Structure

bash syntaxbash
"${!name[*]}"

Return Value

string

Joins assigned indices or keys into one word using the first IFS character when double-quoted.

Working Example

Example Snippetbash
items=([0]=a [5]=b)IFS=: printf '%s\n' "${!items[*]}"
Bash Reference