Subject: Rotating 'random' signatures.

From: [email-masked] (Jim Davis)
Date: 31 May 1994 10:54:08 -0700

Someone's bound to ask sooner or later, so here's a simple approach to
getting a different signature, chosen at 'random', each time you start
up pine.  (Getting a random signature each time you enter pine's
composer is also possible, but more complicated.)  This is for a UNIX
system; I tested it on a Sun workstation running Solaris 2.3:

-------------------------snip snip snip--------------------------------------
#!/bin/sh -

pinesig=$HOME/.pinesig          # what 'signature-file=' is in your .pinerc
realpine=/usr/local/bin/pine    # pathname to the real pine executable
sigfile=$HOME/sigs              # pathname to your file of signatures

#
# Write a 'random' signature to signature-file:
#

/bin/nawk 'BEGIN { RS=""}
                 { sigs[NR] = $0 }
           END   { srand(); print sigs[randint(NR)]}
#	   END   { srand(); print "--"; print sigs[randint(NR)]}
         function randint(n) { return int(n * rand()) + 1}' <$sigfile >$pinesig
#
# Now run the real pine executable
#

exec $realpine
-------------------------snip snip snip--------------------------------------

Call the script 'pine' and put it somewhere in your $PATH ahead of the
real pine executable.  The script uses awk to suck in a file of
signatures; each signature is separated by a blank line, like so:

Jim Davis               | "Get the telescope out of the hall closet, Ed."
[email-masked]   |  -- Mrs. Bighead

Jim Davis               | "1.1, 1.2, 1.3, let's rock!"
[email-masked]   |   -- Elma 'Cooder' Fingerwood

Jim Davis               | "I love making him do that."
[email-masked]   |   -- Clarissa Darling

awk stores the sigs in an array, and then chooses one at 'random' and
writes that to your signature-file.  Once that's done, the script
calls the real pine program.

If you want your signature preceded by a "--" line, the way (t)rn
does, then uncomment the second END statement (and comment out the
first).