On Wed, Jun 29, 2011 at 06:41:25PM +0200, Maarten Billemont wrote:
>
> This is where preceding the element with the index comes in handy: We start
> with the index 1, which lays between element 0 and element 1.
... I have a feeling you're taking this definition from some other
language. Python maybe? In any case, some language I don't know well.
I don't think this is an intuitive definition. Worse, I think it
contradicts all the existing definitions used in Bash.
This is how *I* perceive arrays, at least:
Values: [ a | b | c ]
^ ^ ^
Indices: 0 1 2
Using ${array[@]:1:x} ought to start with "b" regardless of whether x
is positive or negative. "b" is the element with index 1. Doing it
this weird Python(?)-ish way, where the indices and the elements are
half a unit out of phase, seems rather pointless and ridiculous. Or
at the very least, needlessly confusing.