- Removing a specific element by its index
- Clearing all elements in one command

Removing a Specific Element by Index
To delete a single entry in a Bash array, useunset with the array name and the target index:
Bash does not reindex arrays after removal. The original indices remain, leaving gaps in the sequence.
Clearing All Elements
If you need to empty an array completely, omit the brackets when usingunset:
Using
unset array deletes the entire variable. You must redeclare it before adding new elements.