The resend.fixmsg Shell Script

[return-to Explanation of resend] [table of contents] [index]
#! /bin/sh
# $Id: resend.fixmsg,v 1.6 92/07/24 18:23:58 jerry book2 $
### resend.fixmsg - editor for fixing up returned mail
### Usage in MH profile:  resend: -editor resend.fixmsg -nodashmunging
###   MUST ALSO ADD:   -format   OR   -filter xxx
##
##  TO USE THIS, FIRST MAKE A VERSION OF forw NAMED resend
##  (MAKE SYMBOLIC LINK TO forw, ETC.).  THEN, ADD THE ENTRY
##  SHOWN ABOVE TO YOUR MH profile file.
##
##  WHEN YOU START resend, IT BUILDS A DRAFT AND CALLS
##  resend.fixmsg TO EDIT IT.  resend.fixmsg MAKES THE MESSAGE
##  LOOK ALMOST EXACTLY AS IT DID THE FIRST TIME YOU COMPOSED
##  IT, THEN STARTS AN EDITOR (DEFAULT: vi) TO FIX THE ADDRESS.

# $1 IS PATH TO DRAFT (SET BY forw).  THEN ed SCRIPT:
# DELETES LINES THROUGH FIRST "To: (you)".
# DELETES LINES TO BUT NOT INCLUDING NEXT "To: (original)".
# REMOVES Date:/From:/Sender: LINES THAT MAILER PUT IN MESSAGE.
# REMOVES FROM BLANK LINE BEFORE "---- End of Forwarded Message"
#   THROUGH THE END OF THE FILE.
/bin/ed - $1 << "END"
1,/^To: /d
1,/^To: /-1d
1,/^$/g/^Date: /d
1,/^$/g/^From: /d
1,/^$/g/^Sender: /d
$
?^------- End of Forwarded Message?-1,$d
w
q
END

# EDIT WITH $VISUAL, $EDITOR OR vi.  exec TO SAVE A PROCESS:
exec ${VISUAL-${EDITOR-vi}} $1

[Table of Contents] [Index] [Return to Explanation of resend]


Last change $Date: 1996/06/06 15:13:52 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <jpeek@jpeek.com>