Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Suggestion: Option to ignore unmatched quotes when (Q) parameter-expansion flag



On Tue, Apr 19, 2022 at 5:46 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> zmodload zsh/parameter
> functions[funkymatcher]='[[ $1 == '"${u_input}"' ]]'
>
> This will even throw parse errors on most "Bobby Tables" inputs

I was pondering over dinner how to make this more robust ... it
occurred to me that

funkybody='[[ $1 == '"${u_input}"' ]]'
if [[ ${#${(z)funkybody}} -ne 5 ]]
then return 1
else functions[funkymatcher]=$funkybody
if

should handle it?

> although if you want to prevent $(command) substitutions (and
> backticks) you'll need to figure that out yourself.

That continues to be left as an exercise.




Messages sorted by: Reverse Date, Date, Thread, Author