<<< Date Index >>>     <<< Thread Index >>>

Re: Howto run a command in message hooks



Hi Patrick!

On Wed, 24 Oct 2007, Patrick Schoenfeld wrote:

> On Wed, Oct 24, 2007 at 04:56:13PM +0200, Christian Brabandt wrote:
> > Do you mind formating your message with a width < 80 chars?
> 
> no, thats no problem.
> 
> > Depending on what your want try either <shell-escape> or <pipe-message>
> 
> Hm. That and what Dave Evans wrote works, at least partially. Now the
> script is launched, but it does not work as expected.  It starts the
> script which outputs:
> 
> User has asked for a return receipt. Send one? ([yes]/no): 
> 
> and waits for an input ("read yn"), but mutt adds its "Press any key to
> continue...". So it seems that mutt already answers the question (what
> it shouldn't do). Also if I do press return to that question, it
> restarts the script and the game starts from the beginning. Endless,
> until i somehow force it to quit (not that easy).
> 
> The (for now very basic script):
> #!/bin/sh
> 
> TEMP="`mktemp`"
> trap "rm -f $TEMP" INT ABRT EXIT
> tee > $TEMP
> 
> QUESTION="User has asked for a return receipt. Send one? ([yes]/no): "
> echo -n $QUESTION
> read yn
> 
> (I know that this is far from beeing complete, but to test how things
> would work it is enough)

If you have used <pipe-message> I think your stdin has changed to the
messages you piped. And read expects your answer from that filehandle.
So you might try explicitly setting your tty with read yn </dev/tty

This is how I do it for scoring people interactively.


regards,
Christian
-- 
BLACK KNIGHT:  Come on you pansy!
    [hah] [parry thrust]
    [ARTHUR chops the BLACK KNIGHT's right arm off]
ARTHUR:        Victory is mine!  [kneeling]
               We thank thee Lord, that in thy merc-
    [Black Knight kicks Arthur in the head while he is praying]
                                  The Quest for the Holy Grail (Monty Python)