diff options
Diffstat (limited to 'mutt/alias.sh')
-rwxr-xr-x | mutt/alias.sh | 15 |
1 files changed, 15 insertions, 0 deletions
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}" |