setting Sign in /usr/ucb/mail

Steve Hayman sahayman at iuvax.cs.indiana.edu
Thu Feb 14 18:08:29 AEST 1991


Here is a trick for including a .signature with stock BSD mail, which
doesn't have a "sign" variable or anything like that.

Recall that when composing a message, ~v and ~e both invoke
editors on the message.  If you were so inclined you could arrange to
use a different editor program with each of ~v and ~e, by doing
this in the .mailrc

    set VISUAL=/usr/ucb/vi
    set EDITOR=/usr/local/bin/emacs


which would invoke vi when you used ~v, and emacs when you use ~e.
Now there is really no reason why both of these programs have
to be actual text editors.  One could be a program that adds
a .signature.  That's what I do - I use ~v to edit messages
(with vi) and ~e to add a .signature.  I have this in my .mailrc

    set VISUAL=/usr/ucb/vi
    set EDITOR=/u/sahayman/bin/addsig

where "addsig" is a little program that just appends a .signature
file to the file it's given on the command line.    This is
the "addsig" script, which will add a .signature to a mail
message when you type ~e .  I use it all the time.  Works great.


#!/bin/sh
# addsig - hack that adds a signature to $1
# Useful within mail, do a "set EDITOR=/u/sahayman/bin/addsig" in the .mailrc
# and then "~e" becomes a command which adds a signature to a message.
# You can still use ~v to edit mail, since it uses VISUAL
#
# Steve Hayman
# sahayman at cs.indiana.edu

# I don't want mine included by default by anything, so I call it ".sig"
signature=${HOME}/.sig

if [ ! -f $signature ]; then
	echo "${0}: No signature file $signature" 1>&2
	exit 1
fi

case $# in
0)	# add to stdin, useful as a vi filter
	cat
	echo "-- "
	cat $signature
	;;
*)
	(echo "-- "; cat $signature) >>$1
	;;
esac



More information about the Comp.unix.questions mailing list