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:
@@ -55,7 +55,7 @@ echo
|
|||||||
|
|
||||||
for c in "${commands[@]}"; do
|
for c in "${commands[@]}"; do
|
||||||
# Escape all characters that sed could misinterpret.
|
# 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
|
# Find first occurrence of the command in the history file
|
||||||
first="$(grep -Enm1 "$pattern" "$1" | cut -d: -f1)"
|
first="$(grep -Enm1 "$pattern" "$1" | cut -d: -f1)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user