diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/sns/mastodon.sh | 12 |
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 | |||
3 | MAIL="$(cat)" | ||
4 | |||
5 | # Only execute the following script when mail receiver is mastodon@topo.tw | ||
6 | grep -qE "^To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0 | ||
7 | |||
8 | date >>~/Downloads/mastodon.log | ||
9 | echo $$ >>~/Downloads/mastodon.log | ||
10 | awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log | ||
11 | |||
12 | #awk -v RS= 'NR>1' <<<"$MAIL" | toot post >/tmp/mastodon.log | ||