aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2025-02-04 14:32:23 +0800
committerHsieh Chin Fan <pham@topo.tw>2025-02-04 14:32:23 +0800
commitd0b8d19ae027597c7cfeb952737e2a7def7b4b33 (patch)
treef3bd0849234c2a389a760ca228818c4eba6fa424
parent1b538235ea2c25b105687d8dddc1c384b5b1a258 (diff)
Update
-rwxr-xr-xbin/mail/deliver.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/mail/deliver.sh b/bin/mail/deliver.sh
index aba07ef..9701c74 100755
--- a/bin/mail/deliver.sh
+++ b/bin/mail/deliver.sh
@@ -47,14 +47,14 @@ header="$(<<<"$MAIL" sed '/^$/ q; /^[[:blank:]]/ d;')"
47body="$(<<<"$MAIL" sed -n '/^$/,$ p' | sed '1d')" 47body="$(<<<"$MAIL" sed -n '/^$/,$ p' | sed '1d')"
48 48
49# vars about output 49# vars about output
50date=$(date --iso=seconds) 50iso_date=$(date --iso=seconds -d @${epoch})
51maildir=${HOME}/Maildir 51maildir=${HOME}/Maildir
52mailbox= 52mailbox=
53# }}} 53# }}}
54# FUNCTION: Set set_stdout {{{ 54# FUNCTION: Set set_stdout {{{
55set_stdout() { 55set_stdout() {
56 filename=${Subject// /_} 56 filename=${Subject// /_}
57 path=${maildir}/${mailbox}${mailbox:+/}new/${date//:/}.${filename//[^[:alnum:]_]/} 57 path=${maildir}/${mailbox}${mailbox:+/}new/${iso_date//:/}.${filename//[^[:alnum:]_]/}
58 mkdir -p $(dirname $path) 58 mkdir -p $(dirname $path)
59 59
60 exec 1>$path 60 exec 1>$path
@@ -154,7 +154,7 @@ set_stdout && print_mail
154 154
155# log to stderr 155# log to stderr
156declare -i width_mailbox=$(wc -c <<<"${mailbox:-INBOX}") 156declare -i width_mailbox=$(wc -c <<<"${mailbox:-INBOX}")
157spaces="$(printf %$(( 18 - ${width_mailbox} ))s)" 157spaces="$(printf %$(( 16 - ${width_mailbox} ))s)"
158echo -e ${date} ${mailbox:-INBOX} "$spaces" "${heading:-${SUBJECT}}" >&2 158echo -e $(date '+%m-%d %H:%M' -d @${epoch}) "=> ${mailbox:-INBOX}" "$spaces" "${heading:-${SUBJECT}}" >&2
159 159
160# vim:fdm=marker fdl=0 160# vim:fdm=marker fdl=0