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 19131
- From: DervishD <raul@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Would this (o) be very difficult to add?
- Date: Wed, 24 Sep 2003 16:01:14 +0200
- Cc: Zsh <zsh-workers@xxxxxxxxxx>
- In-reply-to: <1030923165535.ZM29098@xxxxxxxxxxxxxxxxxxxxxxx>
- 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>
Hi Bart :)
* 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...
I tried something like this, inserting $RANDOM before each filename
in a for loop, redirecting to sort (or using the (o) modifier to sort
the list by name) and using cut (or ${...##...}) for getting rid of
the random number. No doubt your example is better. Far better ;))
Anyway I keep thinking that the (or) modifier would be useful ;)
Thanks a lot for your answer. It's a neat, short and fast way of
generating random lists :)))
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