#!/bin/bash # simple wrapper that copies the file recieved by mutt to a temporary directory and open it in the background set -euo pipefail command=$1 file=$2 tmpdir=$(mktemp -d 'mutt-open.XXXXXXXXX') filename="${1##*/}" cp "$file" "$tmpdir/$filename" systemd-cat "$command" "$tmpdir/$filename"