X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/9697fb1471e041b28c583426c7e113e2ea621fa9..a83d50d5a64488deb3796bbd0ca0a03b0516cc77:/.mutt/batch-subject-editor?ds=sidebyside 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'"