diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2025-02-04 14:32:23 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2025-02-04 14:32:23 +0800 |
commit | d0b8d19ae027597c7cfeb952737e2a7def7b4b33 (patch) | |
tree | f3bd0849234c2a389a760ca228818c4eba6fa424 | |
parent | 1b538235ea2c25b105687d8dddc1c384b5b1a258 (diff) |
Update
-rwxr-xr-x | bin/mail/deliver.sh | 8 |
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;')" | |||
47 | body="$(<<<"$MAIL" sed -n '/^$/,$ p' | sed '1d')" | 47 | body="$(<<<"$MAIL" sed -n '/^$/,$ p' | sed '1d')" |
48 | 48 | ||
49 | # vars about output | 49 | # vars about output |
50 | date=$(date --iso=seconds) | 50 | iso_date=$(date --iso=seconds -d @${epoch}) |
51 | maildir=${HOME}/Maildir | 51 | maildir=${HOME}/Maildir |
52 | mailbox= | 52 | mailbox= |
53 | # }}} | 53 | # }}} |
54 | # FUNCTION: Set set_stdout {{{ | 54 | # FUNCTION: Set set_stdout {{{ |
55 | set_stdout() { | 55 | set_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 |
156 | declare -i width_mailbox=$(wc -c <<<"${mailbox:-INBOX}") | 156 | declare -i width_mailbox=$(wc -c <<<"${mailbox:-INBOX}") |
157 | spaces="$(printf %$(( 18 - ${width_mailbox} ))s)" | 157 | spaces="$(printf %$(( 16 - ${width_mailbox} ))s)" |
158 | echo -e ${date} ${mailbox:-INBOX} "$spaces" "${heading:-${SUBJECT}}" >&2 | 158 | echo -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 |