A next fine script is done. It reads a random quotes from a folder based db. It is created in Perl :-( I don`t like Perl but I don`t find a solution in other scripting-languages without creating a lot of bloat.
#!/usr/bin/perl
srand($$);
$sigfile = "/home/lars/zitate/lars.sig";
$quotedir = "/home/lars/zitate/";
opendir(SIGS, "$quotedir") || die "Folder of random quotes not found…" ;
@tops = grep(/^\w*\.zit$/, readdir(SIGS));
closedir(SIGS);
$top = int(rand $#tops);
open(TOP, "$quotedir/$tops[$top]");
while(<TOP>) {
print("$_ ");
}
print <TOP>;
close(TOP);
print("\n");
open(QUOTE, "$sigfile") || die "Signature not found…";
print <QUOTE>;
close(QUOTE);
Sadly my eMail-client is still in gtk1 and can`t work with utf8 (Sylpheed-Claws) but I find a solution to handle with this. I`ve created a script such like this:
#!/bin/bash
perl /home/lars/bin/sig.pl | iconv -t iso-8859-15
This script convert the random-signature in a usable charset
Filed under Linux & no comments & one trackback
Trackback specific URI for this entry