aboutsummaryrefslogtreecommitdiff
path: root/contrib/mopenall
blob: 7362197bf8836c9ea69dad4420d7c136e33abcd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh -e
# mopenall [MSG] - open every attachements in xdg-open

[ "$#" -eq 0 ] && set -- .

f="$(mseq "$1" | sed 1q)"
[ -z "$f" ] && printf 'No message %s.\n' "$1" 1>&2 && exit 1

dir=$(mktemp -d -t menter.XXXXXX)
cd "$dir"
mshow -t "$1"
mshow -B -x "$1" 2>/dev/null
for f in * ; do
    xdg-open "$f" &
done
wait
echo rm -r "$dir"
rm -r "$dir"