diff options
Diffstat (limited to 'mutt/message_filter.sh')
-rwxr-xr-x | mutt/message_filter.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mutt/message_filter.sh b/mutt/message_filter.sh new file mode 100755 index 0000000..2b4db0e --- /dev/null +++ b/mutt/message_filter.sh | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd $(dirname $0) | ||
4 | |||
5 | MESSAGE=$(cat) | ||
6 | |||
7 | NEWALIAS=$(echo "${MESSAGE}" | grep ^"From: " | sed s/[\,\"\']//g | awk '{$1=""; if (NF == 3) {print "alias" $0;} else if (NF == 2) {print "alias" $0 $0;} else if (NF > 3) {print "alias", tolower($(NF-1))"-"tolower($2) $0;}}') | ||
8 | |||
9 | if grep -Fxq "$NEWALIAS" alias.topo; then | ||
10 | : | ||
11 | else | ||
12 | echo "$NEWALIAS" >> alias.topo | ||
13 | fi | ||
14 | |||
15 | echo "${MESSAGE}" | ||