In my .muttrc I have attribution set to emulate Outlook-style message quoting like this:set attribution=\n\n-----Original Message-----\nFrom: %f\nSent: %d\n%t\nSubject: %s\nHowever, the %t expando evaluates to To Persons_Name with no colon after the To so I'd like to run it through a shell command to add the colon. I can use backticks to run a shell command but I can't figure out how to get the value of the %t expando in the shell command. I've tried this but it doesn't work:set attribution=\n\n-----Original Message-----\nFrom: %f\nSent: %d\n`echo %t | sed s/^To/To:/`\nSubject: %s\n
How to use expandos in backtick shell command
mutt
The shell commands are executed when the config setting is read, not every time you reply. You can see that by entering set attribution=Date: `date`It never changes. And of course, expandos aren't expanded at that moment.There is way: if you end the string with a |, mutt assumes it is a command and just executes it and uses its output (the documentation says it pipes the arguments through the first word, but that's a lie).The problem is, there isn't any unix command (that I know of) which applies a regex to its arguments and outputs the result. sed, for instance, only works on files or stdin.You have to create that command yourself. In Perl, it would be something like that:#!/usr/bin/perlmy $regexp = shift;my @out;for (@ARGV) {  eval $regexp;  push @out, $_;}print join  , @out;Let's say you put this in your path and name it r.pl (remember to chmod-x it), then you can set your attribution this way:set attribution=r.pl 's/^To /To: /m' 'From: %n\n%t\netc...\n'|Take a look into man perlre to find out why you need to end the regexp with /m.HTH.