Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'i' subscript flag
- X-seq: zsh-users 12759
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users ml <zsh-users@xxxxxxxxxx>
- Subject: Re: 'i' subscript flag
- Date: Thu, 3 Apr 2008 10:26:23 +0100
- In-reply-to: <080402193011.ZM1077@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <20080402153742.GA13167@okita> <080402094106.ZM652@xxxxxxxxxxxxxxxxxxxxxx> <200804021653.m32Grva2023100@xxxxxxxxxxxxxx> <080402193011.ZM1077@xxxxxxxxxxxxxxxxxxxxxx>
On Wed, 02 Apr 2008 19:30:11 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Er, but the doc quite correctly says you can't do *anything* else with
> the (i) flag
No, it doesn't, as far as I can see, and it wouldn't be correct if it did.
It says:
Like `tt(r)', but gives the index of the match instead; this may not be
combined with a second argument. On the left side of an assignment,
behaves like `tt(r)'. For associative arrays, the key part of each pair
is compared to the pattern, and the first matching key found is the
result. On failure substitutes the length of the array plus one, as
discussed under the description of `tt(r)', or the empty string for an
associative array.
The only restriction is the end of the first sentence. What that means is
you can't combine it with a second *subscript*, i.e. after a comma. It's
not particularly clearly expressed since there's nothing here that
naturally corresponds to an "argument".
In any case, you can combine (i) with the (e), (n) and (b) flags.
> The (w) flag works just fine with (r) and (R), it's only (i) and (I)
> that are oddballs.
I fixed that.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author