From 4b66da7ff8060fffdeac1cc4cb27f3182b3f2d46 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Sun, 23 Feb 2014 16:59:47 +0100 Subject: First commit of dotfiles. --- mutt/alias.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 mutt/alias.sh (limited to 'mutt/alias.sh') diff --git a/mutt/alias.sh b/mutt/alias.sh new file mode 100755 index 0000000..3761901 --- /dev/null +++ b/mutt/alias.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +MESSAGE=$(cat) + +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;}}') + +if grep -Fxq "$NEWALIAS" $HOME/.mutt/aliases.txt; then + : +else + if [[ "$NEWALIAS" == "*Google*" ]] || [[ "$NEWALIAS" == "*no-reply*" ]]; then + echo "$NEWALIAS" >> $HOME/.mutt/aliases.txt; + fi +fi + +echo "${MESSAGE}" -- cgit v1.2.3-54-g00ecf