hab noch was nachgestöbert; man muss die Variable bei der Ausgabe schützen wenn Leerzeichen drin sind.
Das Script sieht jetzt so aus und scheint zu funktionieren:
Code:
#!/bin/bash
#
# pipe through
# This will feed the message to a program. If that program returns output,
# the entire message (including the headers) will be replaced with this output.
# If the program does not return output or exits with a return code that's not 0,
# the message will not change. Specify the full path to the program.
# Warning
# Be cautious with this action, as it will easily mess up your messages if the
# filter program does return garbage or extra lines.
#
SUMS=/home/mark/Mail/mailfilter/checksum.txt
TEXT=""
while read LINE
do
TEXT="$TEXT\n$LINE"
done
if echo -e $TEXT | grep -q "\-\-\- NEW FILE:"
then
TEXT=$(echo -e $TEXT | sed -n "/^Log Message:/,/^--- NEW FILE:/ p"| sed "/^--- NEW FILE:/d")
else
TEXT=$(echo -e $TEXT | sed -n "/^Log Message:/,/^Index:/ p" | sed "/^Index:/d")
fi
MD5=$(echo "$TEXT" | md5sum| sed s/\ .*//)
touch $SUMS
if grep -q $MD5 $SUMS
then
echo "DELETE ME PLEASE"
else
echo $MD5 >> $SUMS
#echo -e "$TEXT"
fi
Lesezeichen