Quoth fe...@crowfix.com on Monday, 30 August 2010:
> I've just started thinking on all this capability which I did not know
> existed in mutt.  Is there a way to assign an external command to a
> key which will be passed the path to the message?  For instance, if I
> write a dumb little shell script to move a message into the spam
> maildir ...
> 
>     #!/bin/sh
>     mv -i "$@" ~/Maildirs/junk/new
> 
> can I assign that command to a key so that when I hit the key, it
> invokes the command with the path to the message on that line?
> 
> Mutt has so much more capability than I realized that I may be
> fantasizing a bit much here.
> 
> I also realize that this path passing is only useful for maildirs, not
> mailboxes or imap/pop.  But that's fine with me.
> 
> -- 
>             ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
>      Felix Finch: scarecrow repairman & rocket surgeon / fe...@crowfix.com
>   GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
> I've found a solution to Fermat's Last Theorem but I see I've run out of room 
> o

If you just want to move the message, use <save-message>.  But you can
always define a macro that pipes the message to a script, and then you
can do whatever you want with it.  If it needs to be passed as a file to
another script, you can write it to a tmp file and pass that.  I have a
script called 'farg' for that purpose:

#!/bin/sh
file=`mktemp /tmp/farg.XXXXXX`
cat > $file
`printf "$1" $file`
if [ "`echo $1 | cut -c 1-6`" = "spawn " ]
then
  sleep 5
fi
rm $file

The first argument is a printf format for the command to launch, where %s
will be replaced by the tmp file generated from stdin.

If the process is being spawned, then I wait five seconds so the spawned
process can pick it up before I delete it.  Here's spawn:

#!/bin/sh
$* &

-- 
Sterling (Chip) Camden    | sterl...@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com        | http://chipsquips.com

Attachment: pgpSTEhtApEDc.pgp
Description: PGP signature

Reply via email to