summaryrefslogtreecommitdiffstats
path: root/mutt-open
blob: 2e748334c986bd934d9aec3a4738c81049c61b30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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 -p /tmp -d 'mutt-open.XXXXXXXXX')
filename="${file##*/}"
cp "$file" "$tmpdir/$filename"
systemd-cat "$command" "$tmpdir/$filename" &
disown