On Wed, Jul 11, 2001 at 11:15:13AM -0700, Carl B . Constantine wrote: > Is there anyway in mutt to randomize the signature? I might like to use > a different sig for different replies which is easy enough to do using > mutt/vim combo (del sig :r ~newsig) but how would I randomize between 4 > or 5 sig fileis, or randomize between sigs/quotes from one large file? You might want to try the following perl script which I found somewhere in the mutt archives. Since I can't find the link it came from I've attached it. You fill a file with your favorite quotes say with a name of .mutt_quotes and put "%QUOTE%" in your signature file, say .mutt_signature, where you want a quote replaced. Finally add the following to your .muttrc file: set signature="${HOME}/bin/randsig.pl ${HOME}/.mutt_signature ${HOME}/.mutt_quotes |" Chris -- Normal people are weird; therefore weird people are normal. - Anonymous
#!/usr/local/bin/perl #randsig.pl, by Don Blaheta. Released into public domain, blah, blah, blah. # Generates a signature randomly from a single file of witty quotes which # the user maintains; the quotes can be multi-line, and are separated by # blank lines. # Modifications by Glenn Maynard: # Put your own signature in a file (typically ~/.sig), and your quotes in # another file (ie ~/.randsig). Put "%QUOTE%" in your signature file where # you want a quote replaced. (It will always be the same quote ... if you're # crazy enough to want more then one quote in your signature do it yourself :) # To simply output your sig with no quote (%QUOTE removed), don't specify # a quotefile. $home = $ENV{"HOME"}; if ($#ARGV lt 0 or $#ARGV gt 1) { print "Usage: $^X sigfile [quotefile]\n"; exit 1; } # determine the quote if ($#ARGV eq 1) { open (FI, "$ARGV[1]") or die "Can't open $ARGV[1]"; # count the quotes $sig[0] = 0; while (<FI>) { $sig[$#sig + 1] = tell if /^\s*$/; } # read one srand; seek(FI, $sig[int rand ($#sig + .9999)], SEEK_SET) or die "Can't seek"; while (<FI>) { last if /^\s*$/; $msg .= $_; } } open (SIG, "$ARGV[0]") or die "Can't open $ARGV[0]"; while (<SIG>) { $_ =~ s/%QUOTE%/$msg/; print "$_"; } #Uncomment the next three lines if you also want your sig to be #outputted to ~/.sig (I do this because of some vi macros I have). # removed: read tee(1)