From 4d3c9f2cc429b67612a6556ed3de3caf2690dc57 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:41:48 +0200 Subject: [PATCH] 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. --- .local/bin/filterHistory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/filterHistory b/.local/bin/filterHistory index f806331..803d608 100755 --- a/.local/bin/filterHistory +++ b/.local/bin/filterHistory @@ -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)"