0

I use a print script that I call in my .neomutt/config with

set print_command="/home/myself/.config/neomutt/print.sh" 

It has worked in the past but I haven't had ocassion to print email in a while and it isn't working now. I have been tinkering with the script and it seems like neomutt is not passing the email message itself with the print command.

The print.sh script itself is as follows:

#!/bin/bash
input="$1" pdir="$HOME/Desktop" open_pdf=evince
# check to make sure that enscript and ps2pdf are both installed
if ! command -v enscript >/dev/null || ! command -v ps2pdf >/dev/null; then
    echo "ERROR: both enscript and ps2pdf must be installed" 1>&2
    exit 1
fi

# create temp dir if it does not exist
if [ ! -d "$pdir" ]; then
    mkdir -p "$pdir" 2>/dev/null
    if [ $? -ne 0 ]; then
        echo "Unable to make directory '$pdir'" 1>&2
        exit 2
    fi
fi


tmpfile="`mktemp $pdir/mutt_XXXXXXXX.pdf`" 

enscript --font=Courier8 $input -2r --word-wrap --fancy-header=mutt --encoding=88593 -p - 2>/dev/null | ps2pdf - $tmpfile
$open_pdf $tmpfile >/dev/null 2>&1 &
sleep 1
rm $tmpfile

If I add echo "INPUT: $1" or echo "INPUT: $input", all I see when the command runs is INPUT:. How do I ensure that neomutt passes the actual email to the <print-message> command?

2
  • 'enscript' and 'ps2pdf' are installed?
    – ploth
    Jul 24 '19 at 6:39
  • @ploth they are.
    – Amanda
    Jul 24 '19 at 18:51
0

I've done a lot of research and I found your old posts where you put your print.sh together but I have no idea where you initially got the mutt.hdr from which you are using in --fancy-header=mutt. You probably wrote the file yourself, but you didn't upload it. If you remove that argument your print.sh script is working again but I saw you started to use a new print script with unicode support anyway.

1
  • I spent a lot of yesterday trying to troubleshoot this and dial in something that works. I definitely cribbed the script from somewhere -- I'm usually better about crediting my sources so I can get back to them.
    – Amanda
    Jul 25 '19 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.