Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: compaudit:74: _i_addfiles: assignment to invalid subscript range
- X-seq: zsh-users 14631
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: compaudit:74: _i_addfiles: assignment to invalid subscript range
- Date: Thu, 03 Dec 2009 10:03:25 +0000
- In-reply-to: <200912030952.nB39qFu7005462@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20091203065205.GA15270@xxxxxxxxx> <200912030952.nB39qFu7005462@xxxxxxxxxxxxxx>
Peter Stephenson wrote:
> % test=()
> % for i in {1..$#test}; do print $i; done
> 1
> 0
>
> It's looping over a non-existent and a not-even-valid entry for an empty
> array, which is not very helpful. That number is then being used as
> a subscript for the empty array. I'm not actually sure the syntax
> {1..0} should be doing that, I don't think we've ever defined what it
> does.
Ah, I'm an idiot.
If the numbers are in decreasing
order the resulting sequence will also be in decreasing order.
So the brace expansion is doing exactly what it's been asked to do.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author