summaryrefslogtreecommitdiffstats
path: root/mutt-open
blob: 00dbca18ca171f1af7ba12c58683148a8bd35c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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"