Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Suggestion: Option to ignore unmatched quotes when (Q) parameter-expansion flag
- X-seq: zsh-users 27674
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Re: Suggestion: Option to ignore unmatched quotes when (Q) parameter-expansion flag
- Date: Tue, 19 Apr 2022 18:28:11 -0700
- Archived-at: <https://zsh.org/users/27674>
- In-reply-to: <CAH+w=7Y1kVW0K_bH_sVnmrmsHLNLgNrWnU1vD_KsA1ptZBr91w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <Iz0kbyGCbwv0PGnsLHEURh1T-7yKwXK6k-rDmc0b-pmNPXBfa7gVnkU2Eg1ttq56Qfy7iZYIU1jBX0Y0wThgHpkcao5KY8EbdAQ2gkdcNG4=@protonmail.com> <CAH+w=7Y1kVW0K_bH_sVnmrmsHLNLgNrWnU1vD_KsA1ptZBr91w@mail.gmail.com>
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