construct

Bash unset array element

Removes one assigned indexed element without renumbering. Quote the operand against filename expansion.

Formal Syntax & Structure

bash syntaxbash
unset 'name[index]'

Return Value

exit status

Removes one assigned indexed element without renumbering. Quote the operand against filename expansion.

Working Example

Example Snippetbash
items=(a b c)unset 'items[1]'items+=(d)printf '%s\n' "${!items[@]}"
Bash Reference