From 4e16114bb66323111c8d5bfffa8911629a117c42 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 25 Apr 2014 09:19:10 +0200 Subject: [PATCH] Escape sed delimiter when doing subject replacing --- .mutt/batch-subject-editor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.mutt/batch-subject-editor b/.mutt/batch-subject-editor index e5bb596..0649ac5 100755 --- a/.mutt/batch-subject-editor +++ b/.mutt/batch-subject-editor @@ -21,9 +21,12 @@ if [ -z "${subj:-}" ]; then exit 1 fi +SED_DELIM=, +subj=$(echo "$subj" | sed -re "s${SED_DELIM}\\\&g") + RE_REPLY='((re|aw|antwort)([[(]?[[:digit:]]+[)]]?)?):[[:space:]]*' RE_SUBJ_PREFIX="^Subject:[[:space:]]*(${RE_REPLY})*" RE_SUBJ='.*' -EDITOR="sed -i -re \"s,(${RE_SUBJ_PREFIX})${RE_SUBJ},\\\1$subj,i\"" +EDITOR="sed -i -re \"s${SED_DELIM}(${RE_SUBJ_PREFIX})${RE_SUBJ}${SED_DELIM}\\\1$subj${SED_DELIM}i\"" printf "set editor='${EDITOR} %s'" -- 2.39.2