mutt-wizard/bin/openfile

10 lines
312 B
Plaintext
Raw Normal View History

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