From 38ac21ba5e20e88763dc33261a9f201776661fc9 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 17 Jun 2023 07:46:07 +0200 Subject: [PATCH] alias: Escape the function name when replacing Fixes #8720 --- share/functions/alias.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/alias.fish b/share/functions/alias.fish index 5fe783cab..6588156b5 100644 --- a/share/functions/alias.fish +++ b/share/functions/alias.fish @@ -17,7 +17,7 @@ function alias --description 'Creates a function wrapping a command' for func in (functions -n) set -l output (functions $func | string match -r -- "^function .* --description (?:'alias (.*)'|alias\\\\ (.*))\$") if set -q output[2] - set output (string replace -r -- '^'$func'[= ]' '' $output[2]) + set output (string replace -r -- '^'(string escape --style=regex -- $func)'[= ]' '' $output[2]) echo alias $func (string escape -- $output[1]) end end