cat /path/para/o/arquvo | perl -e '@l=<STDIN>;print $l[rand(@l+1)]' On Mon, Apr 23, 2001 at 02:53:45PM -0300, Adriano Freitas wrote: > Cláudio Max wrote: > > > > Usa alguma função aleatória para gerar um número enre 1 e o total de > tiras. Não sei se já existe alguma pronta, se não existir use algo que > leia os decimais do segundo e multiplique pelo total de linhas. > > []'s > > > > > > # pega o endereço da primeira tira do arquivo "tiras" > > export nometira=`head -n 1 /usr/share/pixmaps/splash/tiras` > > > > # copia _todas_ as demais 494 linhas para um temporário > > # não precisa me dizer, essa solução fede... :-) > > /usr/bin/tail -n 494 /usr/share/pixmaps/splash/tiras > /tmp/tirastmp > > > > # passa a tira selecionada para o "fim da fila" > > echo "$nometira" >> /tmp/tirastmp > > > > # passa o arquivo temporário como definitivo > > mv -f /tmp/tirastmp /usr/share/pixmaps/splash/tiras > > > > > -- > To UNSUBSCRIBE, email to debian-user-portuguese-request@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org > -- "If you have an apple and I have an apple and we exchange apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas." George Bernard Shaw
Attachment:
pgpIRI99J0uSR.pgp
Description: PGP signature