On Fri, Jun 06, 2008 at 11:08:23AM +0200, Andreas Schwab wrote:
> Stephane Chazelas <[EMAIL PROTECTED]> writes:
> 
> > It still doesn't explain why ${@:1:1} expands to $1 and not $2
> 
> For positional parameters indexing starts at 1.
[...]

Alright sorry, that was me being confused. I thought
[EMAIL PROTECTED]:n:1} was giving the (n+1)th element of the array
while it's not, it's giving the first element whose index if
greater or equal to n.

I thought

$ bash -c 'a[1664]=x a[51]=4 a[42]=1; echo "[EMAIL PROTECTED]:1:1}"'

would give "4" because in the sorted list of indexes (42, 51,
1664), 51 is the second.

While it gives "1" because "42" is the first element after "1".

Sorry for the bother,
Stéphane


Reply via email to