[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] IRC Bot em shellscripting
From: |
Thiago Coutinho |
Subject: |
Re: [shell-script] IRC Bot em shellscripting |
Date: |
Sun, 15 Feb 2009 01:10:01 -0200 |
2009/2/14 Kurt Kraut <address@hidden>:
[...]
> Eu poderia fazer um loop ficar dando tail -1 o tempo todo e dar um
> grep em busca de 'gosta de shell'. Porém, se entre um loop e outro o
> bot tiver recebido duas linhas de conversa, ele só interpretaria a
> última. Atentem que o arquivo 'out' cresce constantemente.
>
> Enfim, alguma sugestão? Se algo não ficou claro, por favor, basta perguntar.
Por que não usa "tail -f"?
No próprio site do cara tem um exemplo.
tail -f \\#<CHANNEL>/out |
while read foo ; do
name=$(echo $foo | awk '{print $2}' | sed 's,<\\(.*\\)>,\\1,')
if awk 'BEGIN{srand(); exit rand()<.1)}' ; then
echo "$name: WHAT??" ;
fi;
done
--
Thiago Coutinho - http://thiago.bunghole.com.br/
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc