#!/bin/sh # # monthly_mh_profile_and_sig # # AUTHOR: # Dan Harkless # # COPYRIGHT: # This file is Copyright (C) 1997 by Dan Harkless, and is released under the # GNU General Public License . # # USAGE: # % monthly_mh_profile_and_sig # # EXAMPLE: # % monthly_mh_profile_and_sig dan wave.eng.uci.edu mail/sig_m # # DESCRIPTION: # A companion to monthly_alias -- updates the $1_mmmyy email address in your # signature file and on the Alternate-Mailboxes line of your .mh_profile. See # my monthly_alias script for the justification for this. # # In your .mh_profile, you shouldn't have any other aliases on the # Alternate-Mailboxes line besides your monthly email address. Other aliases # should go after the comma, on subsequent lines. # # In the same directory as your sig file, there should be a file with the same # name as the sig file but with ".template" appended. It should contain # strings with the same names as the date variables below. They will be # replaced by sed with the current values of those variables. For instance, # the string "Month_yyyy" in the sig file would be replaced by the current # date in the form "August 1997". # # DATE MODIFICATION # ========== ================================================================== # 1997-01-14 Original. # Make sure 3 parameters were passed. if [ $# != 3 ]; then progname=`basename $0` echo "usage: $progname " exit 1 fi cd # in case this is being run from the commandline # Get the date in various formats. Month_yyyy=`date +"%B %Y"` mmm=`date +%h | tr "[A-Z]" "[a-z]"` mmmyy_email=$1_`date +%h%y | tr "[A-Z]" "[a-z]"`@$2 wildcard_email=$1_`date +%h%y | tr "[A-Z]" "[a-z]"`@\*$2 # Change the monthly alias in the .mh_profile. trap 'rm -f .mh_profile.$$' 0 1 2 3 15 sed "s/Alternate-Mailboxes:.*/Alternate-Mailboxes: $wildcard_email,/g" \ .mh_profile > .mh_profile.$$ mv .mh_profile.$$ .mh_profile # Change the monthly alias and date fields in the signature file. sed -e "s/Month_yyyy/$Month_yyyy/g" \ -e "s/mmmyy_email/$mmmyy_email/g" \ -e "s/mmm/$mmm/g" \ $3.template > $3