[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Negative indexes in ${arr[@]:off:length}
From: |
Greg Wooledge |
Subject: |
Re: Negative indexes in ${arr[@]:off:length} |
Date: |
Thu, 30 Jun 2011 08:06:35 -0400 |
User-agent: |
Mutt/1.4.2.3i |
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.
- Re: Negative indexes in ${arr[@]:off:length}, (continued)
- Re: Negative indexes in ${arr[@]:off:length}, Greg Wooledge, 2011/06/27
- Re: Negative indexes in ${arr[@]:off:length}, Chet Ramey, 2011/06/27
- Re: Negative indexes in ${arr[@]:off:length}, Steven W. Orr, 2011/06/27
- Re: Negative indexes in ${arr[@]:off:length}, Maarten Billemont, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Maarten Billemont, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Mart Frauenlob, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Maarten Billemont, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Mart Frauenlob, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Greg Wooledge, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length}, Maarten Billemont, 2011/06/29
- Re: Negative indexes in ${arr[@]:off:length},
Greg Wooledge <=
- Re: Negative indexes in ${arr[@]:off:length}, Greg Wooledge, 2011/06/30
- Re: Negative indexes in ${arr[@]:off:length}, Maarten Billemont, 2011/06/30