1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
607 B

#!/bin/bash
FILE="/tmp/mailtmp.txt"
OLD_SUBJECT="/tmp/mailsubject.txt"
trap "rm ${FILE}; exit" SIGHUP SIGINT SIGTERM
# create empty file
>${FILE}
if [[ -w ${OLD_SUBJECT} ]]; then
# read subject from file
oldsubject=$(<${OLD_SUBJECT})
else
# create empty file
>$OLD_SUBJECT
oldsubject="New subject"
fi
# set subject line
kdialog --inputbox "New subject:" "${oldsubject}" >${OLD_SUBJECT}
subject=$(<${OLD_SUBJECT})
# save mail in file
cat $* > ${FILE}
# change subject line
sed -i "s/^Subject: \(.*\)/Subject: ${subject}/" ${FILE}
# return file
cat ${FILE}
# delete email file
rm ${FILE}