On Fri, Nov 17, 2000 at 01:09:16AM +0000, Conor Daly wrote:
> On Thu, Nov 16, 2000 at 04:25:20PM -0500 or so it is rumoured hereabouts,
> Jorg Ziefle thought:
> > I want to pipe a message from within Mutt to a Perl program, which not
> > only processes it, but as well reads some user input from STDIN. As far
> > as I know, the <pipe-message> command ('|') only allows to _write_ the
> > message to STDOUT, but then returns immediately (as its name suggests).
> >
> > So, is there a possibilty to achieve printing to a message to an
> > external program which is then executed _before_ returning to Mutt?
> >
> I've fought that fight before and AFAIK, there's no way to catch stdin
> from mutt. It *is* possible to capture input from the current tty with
> the $THIS_TTY variable. Just do a "read SOMETHING < $THIS_TTY" but mutt
> handles anything that comes in on *its* tty and so this isn't possible
> here.
I'm not sure I understand what you're trying to do here. I _think_ you
want to pipe a message to some command, then query the user for some
parameters before processing the message, then process the message, and
finally return to mutt. If so, then yes, you _can_ do this with mutt
and a shell script around your external program. Here's an example
using 'fold' just for concreteness.
cat > /tmp/mutt_tmp_file # Save stdin.
exec < /dev/tty # Redirect stdin from the terminal.
echo "Enter page width:"
read width
fold -w $width < /tmp/mutt_tmp_file
rm -f /tmp/mutt_tmp_file
If you save this script as 'mutt_fold', then pipe your message from mutt
as
|mutt_fold
the script will query you for the page width, then send the folded
output to stdout. Is that what you wanted to do?
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | RF Communications Product Generation Unit
| Spokane, Washington, USA