aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sns/mastodon.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/sns/mastodon.sh b/tools/sns/mastodon.sh
new file mode 100755
index 0000000..1118c20
--- /dev/null
+++ b/tools/sns/mastodon.sh
@@ -0,0 +1,12 @@
1#! /bin/bash
2
3MAIL="$(cat)"
4
5# Only execute the following script when mail receiver is mastodon@topo.tw
6grep -qE "^To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0
7
8date >>~/Downloads/mastodon.log
9echo $$ >>~/Downloads/mastodon.log
10awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log
11
12#awk -v RS= 'NR>1' <<<"$MAIL" | toot post >/tmp/mastodon.log