[lang-ref] ( shift_item ) ( bash )
@test "shift item" {
# unset 'items[0]'
items=(A B C D E)
first_item="${items[0]}"
unset 'items[0]'
[ "$first_item" = "A" ]
[ ${#items[@]} -eq 4 ]
[ "${items[*]}" = "B C D E" ]
# Note: unset 'items[0]' doesn't reindex the array
[[ ${items[0]} = "" ]]
[[ ${items[1]} = "B" ]]
items=("${items[@]}") # reindex the array if necessary
[[ ${items[0]} = "B" ]]
[[ ${items[1]} = "C" ]]
}