Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Subscripting without temporaries
- X-seq: zsh-users 7344
- From: DervishD <raul@xxxxxxxxxxxx>
- To: Lloyd Zusman <ljz@xxxxxxxxxx>
- Subject: Re: Subscripting without temporaries
- Date: Tue, 13 Apr 2004 19:17:08 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <m3y8oz7rw8.fsf@xxxxxxxxxx>
- Mail-followup-to: Lloyd Zusman <ljz@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
- References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@xxxxxxxxxxxxxxxxxxxxxxx> <m3y8oz7rw8.fsf@xxxxxxxxxx>
Hi Lloyd :)
* Lloyd Zusman <ljz@xxxxxxxxxx> dixit:
> > However, as you can treat strings as arrays and index them by character,
> > and also do slices with pairs of indices:
> > txt="Some text [particular text] Another text"
> > print -l $txt[1,$txt[(i)\[]-2] $txt[(r)\[,(R)\]] $txt[$txt[(I)\]]+2,-1]
> This is cool. But what options are necessary in order to make this
> work? The commands above produce this output for me:
>
> Some
> text
> [particular
> text]
> Another
> text
>
> This is the same as what I get with this:
>
> print -l $txt
You have shwordsplit set. Unset it. Believe me, is much better
that way if you work with arrays, parameters and the like ;)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author