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

Re: Sorting file names randomly



    Hi :)

 * DervishD <zsh@xxxxxxxxxxxx> dixit:
>     How about this?:
> 
> function shuffle () {
> 
>     emulate -L zsh 
>     
>     setopt nullglob globdots rcexpandparam
>     
>     RANDOM=`date +%s`
>     [[ $# -eq 0 ]] && set '*'
> 
>     reply=()

    Of course this is not needed, I left it in place from a
modification I did to test.

>     reply=($*)
>     reply=($reply(e:'REPLY="${(l.5..0.)RANDOM} $REPLY"':))
>     reply=(${(o)reply})

    How could I avoid doing this? I cannot put the 'o' in the
assignment above this one because it doesn't work, it seems to sort
*before* applying the 'e' glob modifier).

>     reply=(${reply/#????? /})
> 
>     print -l $reply
> 
>     return 0
> }

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...



Messages sorted by: Reverse Date, Date, Thread, Author