diff options
author | Luke Smith <luke@lukesmith.xyz> | 2018-11-06 15:08:23 -0500 |
---|---|---|
committer | Luke Smith <luke@lukesmith.xyz> | 2018-11-06 15:08:23 -0500 |
commit | 26c0df4511461c2062784531458b6b84ea73e6b0 (patch) | |
tree | bd71443aa4e431a002d1a4b1ce57334f68b9604a /etc/openfile.sh | |
parent | f0abb7190ab74155a344f31812330ca2aa9a855a (diff) |
more general openfile script
Diffstat (limited to 'etc/openfile.sh')
-rwxr-xr-x | etc/openfile.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/etc/openfile.sh b/etc/openfile.sh new file mode 100755 index 0000000..c866932 --- /dev/null +++ b/etc/openfile.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Helps open a file with xdg-open from mutt in a external program without weird side effects. + +base=$(basename "$1") +ext="${base##*.}" + +file=$(mktemp -u --suffix=".$ext") + +rm -f "$file" + +cp "$1" "$file" + +setsid xdg-open "$file" >/dev/null 2>&1 & |