Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Would this (o) be very difficult to add?



    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