dominic revidoval tento gist . Přejít na revizi
1 file changed, 37 insertions
change-subject-kmail.sh(vytvořil soubor)
@@ -0,0 +1,37 @@ | |||
1 | + | #!/bin/bash | |
2 | + | # | |
3 | + | # Author: Dominic Reich <quick.hat4396@qtztsjosmprqmgtunjyf.com> | |
4 | + | ||
5 | + | FILE="/tmp/mailtmp.txt" | |
6 | + | OLD_SUBJECT="/tmp/mailsubject.txt" | |
7 | + | ||
8 | + | trap "rm ${FILE}; exit" SIGHUP SIGINT SIGTERM | |
9 | + | ||
10 | + | # create empty file | |
11 | + | >${FILE} | |
12 | + | ||
13 | + | if [[ -w ${OLD_SUBJECT} ]]; then | |
14 | + | # read subject from file | |
15 | + | oldsubject=$(<${OLD_SUBJECT}) | |
16 | + | else | |
17 | + | # create empty file | |
18 | + | >$OLD_SUBJECT | |
19 | + | oldsubject="New subject" | |
20 | + | fi | |
21 | + | ||
22 | + | # set subject line | |
23 | + | kdialog --inputbox "New subject:" "${oldsubject}" >${OLD_SUBJECT} | |
24 | + | ||
25 | + | subject=$(<${OLD_SUBJECT}) | |
26 | + | ||
27 | + | # save mail in file | |
28 | + | cat $* > ${FILE} | |
29 | + | ||
30 | + | # change subject line | |
31 | + | sed -i "s/^Subject: \(.*\)/Subject: ${subject}/" ${FILE} | |
32 | + | ||
33 | + | # return file | |
34 | + | cat ${FILE} | |
35 | + | ||
36 | + | # delete email file | |
37 | + | rm ${FILE} |
Novější
Starší