mutt-wizard/bin/openfile

10 lines
312 B
Plaintext
Raw Normal View History

2018-11-06 21:08:23 +01:00
#!/bin/sh
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
2019-05-02 02:37:12 +02:00
[ $(uname) = "Darwin" ] && opener="open" || opener="setsid xdg-open"
2018-11-06 21:08:23 +01:00
base=$(basename "$1")
ext="${base##*.}"
file=$(mktemp -u --suffix=".$ext")
rm -f "$file"
cp "$1" "$file"
2019-05-02 02:37:12 +02:00
$opener "$file" >/dev/null 2>&1 &