This is a somewhat contrived example

11. maaliskuuta 2026 klo 8.49
Sijainti: Vianhallintajärjestelmät: Github
Avainsanat: shfmt

I noticed that for the specific case of picking an element from the end using just the size of the array itself, the above is a somewhat contrived example; a plain -1 would work just as well. But I can change the example script as below, and the difference between outputs still holds:

#!/bin/bash

array=(
    "a"
    "b"
    "c"
)

i=3

value="${array[i - 1]}"

printf "%s\n" "${value}"

Vastaa viestiin sen kontekstissa (Github)