[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mutt & send hook



On Sat, Sep 15, 2001 at 09:10:14PM +0000, Rajesh Fowkar wrote:
| Hi,
| 
| I have got the following in my muttrc :
| 
| set default_hook="~C %s"
| send-hook ! ^(howtos|linux-india|debian-user|ilug-goa|icewm) 
|           "set editor='/usr/local/bin/rajeshsign.sh'"
| send-hook ^(howtos|linux-india|debian-user|ilug-goa|icewm) 
|           "set editor='/usr/local/bin/lostsign.sh'"
| 
| ( Each send-hook is on one line )
| 
| What I want is if the CC or TO address is of the mailing lists than execute
| lostsign.sh script else execute rajeshsign.sh.
| 
| --------------------------------------------------------------------------
| rajeshsign.sh is :
| 
| INFILE=$1
| echo -en "\n\n\n" >> $INFILE
| cat $HOME/.rajeshsign >> $INFILE
| fortune -s >> $INFILE
| vi $INFILE
| rm -rf $INFILE
| --------------------------------------------------------------------------
| 
| --------------------------------------------------------------------------
| lostsign.sh is :
| 
| INFILE=$1
| echo -en "\n\n\n" >> $INFILE
| cat $HOME/.rajeshsign >> $INFILE
| fortune /usr/share/games/fortunes/lost >> $INFILE
| vi $INFILE
| rm -rf $INFILE
| --------------------------------------------------------------------------
| 
| But whenever I start to type any mail and than quit vi I get the message as
| message is unmodifed ? This happens inspite of my typing the
| contents in the mail. If I say yes I come to the screen where I have to
| send the mail,( presss y ), However the mail is empty ??
| 
| Any problems with my script ?

Yes: you shouldn't be removing the message when you finish writing it.
Mutt will remove it once it is sent.  That is kind of like if vi
removed the file every time you quit it.  Thus mutt doesn't see any
changes between the original (empty/nonexistant) and what it is when
your "editor" finishes (nonexistant).

HTH,
-D



Reply to: