help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: Suggestion: Option to ignore unmatched quotes when (Q) parameter-expansion flag
Date: Tue, 19 Apr 2022 18:28:11 -0700	[thread overview]
Message-ID: <CAH+w=7bTrEOJBZcRMOZjLUtE6O1=1N=aj5Oyen+Ci=kymPJBiw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Y1kVW0K_bH_sVnmrmsHLNLgNrWnU1vD_KsA1ptZBr91w@mail.gmail.com>

On Tue, Apr 19, 2022 at 5:46 PM Bart Schaefer <schaefer@brasslantern.com> 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

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.

      reply	other threads:[~2022-04-20  1:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 21:12 dg1727
2022-04-17 19:43 ` Daniel Shahaf
2022-04-20  0:46 ` Bart Schaefer
2022-04-20  1:28   ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bTrEOJBZcRMOZjLUtE6O1=1N=aj5Oyen+Ci=kymPJBiw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: Suggestion: Option to ignore unmatched quotes when (Q) parameter-expansion flag' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).