[TAG] Tip: Mini-fortune
jimregan at o2.ie
Sat Apr 17 00:53:42 MSD 2004
*Ever since I started using Wikiquote <http://www.wikiquote.org>, I've
tried to keep track of the most memorable quotes I've found in books.
While I still had net access, I'd stick them into the relevant category
on Wikiquote, but now I keep them in fortune files.
Problem is, I rarely keep the version in the fortunes directory in sync
with the version I work on, so the newest quotes never appear. So, I
mangled Ben's gibberish.pl
<http://www.linuxgazette.net/issue89/lg_mail.html#mailbag.2> to read
===== CUT HERE mf.pl.txt =====
open (QUOTES, "< $ARGV") || die "Can't open quote file: $!";
undef $/;@f=split("%\n", <QUOTES>);print "$f[rand at f]";
===== CUT HERE =====
Now I can use the current version with the 'Wanda' applet in GNOME, or
with the 'starwars' screensaver.
Before Ben beats me to it, I think it's only proper to try a one-liner
perl -we 'undef $/;@f=split("%\n", <>);print "$f[rand at f]";' quotefile
(I tried using -F, but couldn't get it to work :()*
More information about the TAG