Tech Corner

PERL Script - Random Email Signature

[Last Updated: Monday, 09-Apr-2007 21:52:57 EDT]

The following PERL script chooses a random quote from the list at the bottom separated by --sig-- and writes it to a text file with whatever static content you wish to appear. This file can then be used as your signature file in Pine or Elm etc. on a Unix system to add a little personality and keep your emails from being too dull and boring.

You can set this script to execute each time you login to your shell account in your .profile or you can create an alias command shortcut that executes this script and then launches your mail client.

You can add your own quotes, sayings, jokes etc. at the bottom of the script. The --sig-- delimiter must not have any spaces after it and must have a single blank line before it. Follow the included examples when creating your own.


DISCLAIMER
 
No Warranty of any kind is expressed or implied with respect to the information contained in this document!
The information found here is compiled for the convenience of anyone looking for general guidelines and best practices for configuration based on my own professional experience, as well as industry standards.
Use this information at your own risk!
 
Scott S. 2007


#!/usr/bin/perl -0177s

# makesig: pick one of the sigs below at random and write it to .signature.
# usage: makesig [num].  If num is unspecified, a sig is chosen at random.

$sigfile = '~/.signature';

srand(time);

@sigs = split /--sig--\n/, <DATA>;
$i = @ARGV ? shift : int rand($#sigs+1);

open (SIG, ">$sigfile") or die "Crap! Can't write to .signature: $!\n";
print "$0: Picking signature number $i.\n";
print SIG " Your Name\n email(at)domain\.com\n www\.domain\.com\n\n  Random Quote:\n";
print SIG $sigs[$i];
close SIG;

exit(0);

__END__
--sig--
        I can only please one person per day.  Today is not your day.
                Tomorrow is not looking good either.

--sig--
        I love deadlines.  I especially like the whooshing sound they make
                        when they go flying by.

--sig--
        Does the name Pavlov ring a bell?

--sig--
        Never go to a doctor whose office plants have died.

--sig--
        For every credibility gap, there is a gullibility fill.

--sig--
        I wonder if Adam ever said to Eve,
        "Watch it!!! There are plenty more ribs where YOU came from!"

--sig--
        The first half of our lives is ruined by our parents,...
        and the second half by our children.

--sig--
        Why is lemon juice made with artificial flavor, and dishwashing
        liquid made with real lemons?

--sig--
        My wife and I always kiss each other goodnight.
        It's like touching gloves before we spend the night fighting over
        the covers!

--sig--
        Some folks say that I have a very bad attitude.
        But actually,...
                I have an excellent one!
                        It just happens to be negative.


DISCLAIMER
 
No Warranty of any kind is expressed or implied with respect to the information contained in this document!
The information found here is compiled for the convenience of anyone looking for general guidelines and best practices for configuration based on my own professional experience, as well as industry standards.
Use this information at your own risk!
 
Scott S. 2007

Last Revised: Monday, 09-Apr-2007 21:52:57 EDT


Privacy Statement   SSL Security by 
www.cacert.org