-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyscan
executable file
·62 lines (50 loc) · 989 Bytes
/
yscan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
## $Id: yscan,v 1.3 2015/04/19 17:53:27 yozo Exp $
##
SHOW_FROM="show_from"
SHOW_DATE="show_date"
SHOW_SUBJECT="show_subject"
help(){
echo "usage: ${progname} messageID"
}
## main
flag_debug=0
FILE=
FILEbasename=
case "$1" in
-h*)
help
exit 0
break
;;
-debug)
flag_debug=1
shift
;;
esac
LIST=
if [ -n "$*" ]; then
LIST=`mhlist -noheader -part 0 $* | egrep -v '^ ' | awk '{print $1;}'`
fi
if [ ${flag_debug} -eq 1 ]; then
echo "args: $*"
echo "LIST: ${LIST}"
fi
## if nothing specified, we assume the current message.
if [ -z "${LIST}" ]; then
LIST="cur"
fi
for i in ${LIST}
do
FILE=`mhpath "${i}"`
if [ ! -f "${FILE}" ]; then
( echo "${FILE} not found." 1>&2 )
exit 20
fi
FILEbasename=`basename "${FILE}"`
from=`cat "${FILE}" | "${SHOW_FROM}"`
date=`cat "${FILE}" | "${SHOW_DATE}"`
subject=`cat "${FILE}" | "${SHOW_SUBJECT}"`
echo "${FILEbasename} ${date} ${from} ${subject}"
done
########