On Thu, May 06, 2021 at 10:42:36AM +0300, Oğuz wrote:
> 6 Mayıs 2021 Perşembe tarihinde Ulrich Windl <
> ulrich.wi...@rz.uni-regensburg.de> yazdı:
> >
> > But why is $# decremented after the first unset?
>
> Because `x[0]' existed then, and the number of x's members changed with its
> removal. `${
Currently, to know the index of an array's indexes (example: first or
last index), it needs an intermediary index array:
#!/usr/bin/env bash
declare -a array=([5]=hello [11]=world [42]=here)
declare -ai indexes=("${!array[@]}")
declare -i first_index=${indexes[*]:0:1}
declare -i last_index=${i
6 Mayıs 2021 Perşembe tarihinde Ulrich Windl <
ulrich.wi...@rz.uni-regensburg.de> yazdı:
>
> But why is $# decremented after the first unset?
>
Because `x[0]' existed then, and the number of x's members changed with its
removal. `${#x[@]}' doesn't give you the top index of `x', it expands to
the n