cr_date=01/02/07  # Never change this.

rev_date=08/08/07 # Change this when you revise.


# # PURPOSE OF PROGRAM:

# To prepare a file for batch personalized mailing on a Mac not connected to a UNIX server. The 2nd argument 

# maillist=$2 contains one line for each possible recipient of the message=$1. Lines of $maillist are prepared 

# as arguments to the message.

# Example: If there are five arguments on each $maillist line, then where the message has $5, it substitutes 

# item #5 on that recipient line. To allow spaces in an argument, use @@ in place of a space.  

# This program came about because the interface on my Mac and the Mail program wasn't completely under UNIX. 

# The first line of $message has the form: Msg Title: [Whatever subject is desired] 

# The result is that the message has a default Subject: [short name of $message followed by the subject] 

# $mlss allows changing the subject dynamically if desired. 


# # HISTORY OF SIGNIFICANT REVISIONS: 

# 08/08/07: There was a glitch in extracting a name, one $line at a time, from $maillist. 

#  Most programs have more historical revisions. This one was an easy interface to $mlss that is Mac dependent. 


# # SET VARIABLES:

user=$HOME

base_prog=`basename $0`

dsply_prog=$user/unix/cshƒ/dsply

# Example: $dsply_prog lchain or llclasp

# Location of the special directory containing most of the often-changing files

specdir=$HOME/`cat $HOME/which_dir`

message=$1

maillist=$2

# This is the program that allows most of the functionality in mailing the merge between $message and $maillist: 

# It allows attachments, and other styles of personalization. 

mlss=$user/unix/mailƒ/mlss


# # PROGRAM STARTS:


counter=0

while [ "$counter" -eq 0 ] 

do 

echo "e(nd) program or p(ick) another line?"

read choice

case $choice in 

e) counter=1 ;;

p) list=`cat -n $maillist`

echo "Choose a line number to get that line as output.

`cat -n $maillist`" | more

read number

line=`cat -n $maillist | egrep "^ *$number[ ]" | sed '1,$s/^ *'$number' *//' | sed '1,$s/^ *//'`

echo "$line" > $maillist.line

$mlss $message $maillist.line  ;;

esac

done

rm *\.line


# Last line of program:

echo "%% $base_prog last revised $rev_date. Created $cr_date %%"