diff --git a/ani-cli b/ani-cli index 37a18368c..01979311b 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.14.1" +version_number="4.14.2" # UI @@ -368,7 +368,9 @@ process_hist_entry() { update_history() { if grep -q -- "$id" "$histfile"; then - sed -E "s|^[^ ]+ ${id} [^ ]+$|${ep_no} ${id} ${title}|" "$histfile" >"${histfile}.new" + # escape sed special chars in replacement: & and \ and delimiter | + safe_title=$(printf '%s' "$title" | sed 's/[&\|]/\\&/g') + sed -E "s|^[^ ]+ ${id} [^ ]+$|${ep_no} ${id} ${safe_title}|" "$histfile" >"${histfile}.new" else cp "$histfile" "${histfile}.new" printf "%s\t%s\t%s\n" "$ep_no" "$id" "$title" >>"${histfile}.new"