zsh:filterHistory: Escape {B,E}OL markers

Especially the dollar sign is used often making this important. Commands
containing one of both were not deleted properly.
This commit is contained in:
2020-09-24 03:41:48 +02:00
parent f69efff5c0
commit 4d3c9f2cc4

View File

@@ -55,7 +55,7 @@ echo
for c in "${commands[@]}"; do
# Escape all characters that sed could misinterpret.
pattern="^: [0-9]+:[0-9]+;$(sed -E 's/[./?+|()*\\]|\[|\]/\\&/g' <<<"$c")\$"
pattern="^: [0-9]+:[0-9]+;$(sed -E 's/[./?+|()*\\^$]|\[|\]/\\&/g' <<<"$c")\$"
# Find first occurrence of the command in the history file
first="$(grep -Enm1 "$pattern" "$1" | cut -d: -f1)"