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

Re: pretty easy thing but too hard for me! (random array element)



On Thursday 2007-08-02 11:52 +1000, Jean-Rene David output:
:* fREW [2007.08.01 18:00]:
:> AWESOME!  Now I can read a random dinosaur comic
:Would you mind sharing that awesome off-list reply
:with the rest of us?

See the randline function (distributed with zsh for over 15 years) for a hint.
Something like the following will do it.

FILES=( .../files/* )
feh $FILES[$RANDOM%$#FILES+1]

Regards,
Geoff



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