From 818ebdc1449baa3ceeb06c13b6c3232ac4dbffd3 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 3 Jun 2022 15:40:45 +0200 Subject: [PATCH] zsh:funcs:suffix: Support quotes Quotes need to be escaped, otherwise `(Q)` will not work on potential uneven number of quotes. --- .config/zsh/zshrc.d/40-functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 6c34a8d..8b15e96 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -554,8 +554,8 @@ suffix() { # starting point is passed to `find`, which then defaults to `.`. local -a names - # Take everything before "--" - names=( "${@:1:$((i-1))}" ) + # Take everything before "--" and quote special characters + names=( "${(@q)@:1:$((i-1))}" ) # Prepend an `*` to every element and quote the result names=( "${(@)names//(#b)(*)/\"*$match\"}") # Join with " -o -name " and then split again using shell parsing