builtin-option
Bash declare -a
Declares an indexed array; indices are arithmetic expressions. Use trusted or validated indices.
Formal Syntax & Structure
bash syntaxbash
declare -a name[=(values ...)]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | identifier | Array variable. |
Return Value
exit status
Declares an indexed array; indices are arithmetic expressions. Use trusted or validated indices.
Working Example
Example Snippetbash
declare -a items=(red 'dark blue')printf '%s\n' "${items[0]}" "${items[1]}"