Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Would this (o) be very difficult to add?
- X-seq: zsh-workers 19145
- From: DervishD <raul@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh <zsh-workers@xxxxxxxxxx>
- Subject: Re: Would this (o) be very difficult to add?
- Date: Sat, 27 Sep 2003 13:18:34 +0200
- In-reply-to: <20030924140114.GC411@DervishD>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
- References: <20030923161213.GA772@DervishD> <1030923165535.ZM29098@xxxxxxxxxxxxxxxxxxxxxxx> <20030924140114.GC411@DervishD>
Hi Bart and zsh workers :))
* DervishD <raul@xxxxxxxxxxxx> dixit:
> * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> > } Sometimes we want to do globbing and sort the output randomly:
> > } when generating playlists, when generating image slideshows, etc...
> > Try this:
> > print -lP *(e:'REPLY=%0(l..$RANDOM)"$REPLY"':)
> Very clever, I'd never have thought about something like that...
This solution has worked great for generating, for example, a
file containing the names of the files in random order. The problem
is that I cannot use this in a command: command $(print -lP...)
results in 'command file name 1 file name 2', unquoted :((( Strictly
speaking, characters like '[' are quoted, but spaces arent, and the
names which I want to order randomly usually contain spaces.
I've tried something like 'array=($(print -lP...))', but since
the expansion has spaces unquoted, the elements of the array end up
being 'file', 'name', '2', 'file', 'name', '1', and so on.
How can I get the result of the 'e' glob qualifier quoted, so I
can use command $(print -lP...) and get a working command?
Thanks a lot :))
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