Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Question on array processing.
- X-seq: zsh-users 10783
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: "Larry P. Schrof" <larry@xxxxxxxxxx>
- Subject: Re: Question on array processing.
- Date: Wed, 4 Oct 2006 15:10:18 -0500
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20061004200759.GG54791@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061004200025.GA3092@xxxxxxxxxxxxxxxxx> <20061004200759.GG54791@xxxxxxxxxxxxxxxx>
In the last episode (Oct 04), Dan Nelson said:
> In the last episode (Oct 04), Larry P. Schrof said:
> > I'm tring to do something like:
> >
> > > str="these:are:some:words"
> > > echo ${str[(ws:::)2]}
> > zsh: bad math expression: operand expected at `::)2'
> >
> > I've also tried :":":, :\::, and :':': - none of those work.
> >
> > Is this a small flaw / hole in zsh's functionality?
>
> You can use any character as a delimiter, not just a colon:
>
> $ str="these:are:some:words"
> $ echo ${str[(ws/:/)2]}
> are
Forgot to include the documentation that mentions this:
The following flags (except p) are followed by one or more
arguments as shown. Any character, or the matching pairs
`(...)', `{...}', `[...]', or `<...>', may be used in place of a
colon as delimiters, but note that when a flag takes more than
one argument, a matched pair of delimiters must surround each
argument.
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author