Skip to navigation

Mutt: set dynamic email signature from shell command output

I want to set my signature when mailing to the r-help mailing list to contain information about the R version I have currently installed. Creating a bash script that directly echoes the several lines that I want to have in my signature and executing that in the muttrc using backticks gives a “broken pipe” error.

One solution (I’m sure there are others, maybe better ones) is to make the shell script create a temporary signature file and echo the path to that file, then execute the shell script using backticks.

Shell script (don’t forget to chmod 744):

#!/bin/bash                                                                                          

thesigfile=~/.mutt/rsig

echo  "Marianne Promberger PhD, King's College London
http://promberger.info" > $thesigfile
R --version | head -n 1 >> $thesigfile
cat /etc/issue | head -n 1 | cut -d " " -f 1-2 >> $thesigfile
echo $thesigfile

muttrc:

send-hook '~t r-help' 'set signature=`~/.mutt/signature_r-help`'

Leave a Reply