openfile (381B)
1 #!/bin/sh 2 3 # Helps open a file with xdg-open from mutt in a external program without weird side effects. 4 tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" 5 file="$tempdir/${1##*/}" 6 [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" 7 mkdir -p "$tempdir" 8 cp -f "$1" "$file" 9 $opener "$file" >/dev/null 2>&1 10 find "${tempdir:?}" -mtime +1 -type f -delete