6 Mayıs 2021 Perşembe tarihinde Ulrich Windl < ulrich.wi...@rz.uni-regensburg.de> yazdı:
> Hi! > > Considering the example given in https://unix.stackexchange. > com/a/648243/320598 I think it may be a bug, or an inappropriately > documented feature. > > Basically: > % x=(1 2 3) > % echo "${#x[@]}"; echo "${x[@]}" > 3 > 1 2 3 > % unset x[0] > % echo "${#x[@]}"; echo "${x[@]}" > 2 > 2 3 > % unset x[0] > % echo "${#x[@]}"; echo "${x[@]}" > 2 > 2 3 `unset x[0]' doesn't change indexes of other elements in `x'. $ x=(1 2 3) $ declare -p x declare -a x=([0]="1" [1]="2" [2]="3") $ unset x[0] $ declare -p x declare -a x=([1]="2" [2]="3") And there is nothing in the documentation that suggests otherwise. > % unset x[0] > % echo "${#x[@]}"; echo "${x[@]}" > 2 > 2 3 > > -- Oğuz