Hello All,
I wrote a script and I'm having problems with TRAP= variable. I want to
use a temporary file and delete it before procmail dies. the script
looks like:
SHELL=/bin/sh # for other shells, this might need adjustment
VERBOSE=off
PATH=/usr/bin:/opt/local/bin:/usr/lib:/usr/sbin
SENDMAIL=/usr/lib/sendmail
FORMAIL=/opt/local/bin/formail
LOGFILE=/var/log/procmail
TEMPORARY=/tmp/pmail.$$
TRAP="/bin/rm -f $TEMPORARY"
SUBJECT=`$FORMAIL -xSubject:`
TO=`$FORMAIL -xTo:`
FROM=`$FORMAIL -xFrom\ | cut -d@ -f1 `
:0
# Perform check to make sure it was for the helpdesk
* ^TOhelp2500
* !^FROM_DAEMON
* !^X-Loop:(_dot_)*help2500(_at_)Basit(_dot_)COM
# Send the Auto-Reply message and forward to helpdesk staff
# and put a request in remedy
{
:0c
! helpdesk
:0C
### Write an autoreply mail ###
[...]
# Grab the body
:0bc:
$TEMPORARY
:0
### Write a new messege using echo statements for the header
### and the "$TEMPORARY" is catted inside. I forward that mail
### somewhere.
}
I figured I would be better off removing the $TEMPORARY once I'm done but if I
set the TRAP variable, for some reason, I never get to re-use in the last
section. I grab it OK in section 3 but when I get to section 4, to forward it,
it's gone.
Any tips.
--
Charles Gagnon | Any reproduction, in whole or in part,
Collective Technologies | of the opinions herein without written
a Pencom Company | consent of the National Opinion Guild
Charlesg(_at_)CollTech(_dot_)COM | is strictly forbidden.
In Europe, do you think Miles Davis is known as
Kilometers Davis? Thank you.
-- Stephen Wright's complete standup routine on
The_Late_Show_ with David Letterman, Aug. 29 1994