zsh-users
 help / color / mirror / code / Atom feed
From: "Lawrence Velázquez" <vq@larryv.me>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: protect spaces and/or globs
Date: Tue, 9 Feb 2021 19:22:38 -0500	[thread overview]
Message-ID: <52D5DA56-397F-40BB-BBA7-CE3BF7256581@larryv.me> (raw)
In-Reply-To: <a95f96f5-6beb-3963-b754-17f33f41430f@eastlink.ca>

> On Feb 9, 2021, at 6:45 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> 
> On 2021-02-09 1:08 p.m., Peter Stephenson wrote:
>> 
>>> In this case, actually, all you're doing is the equivalent of
>>> a single array assignment.
>>> 
>>> filespec=("$@")
>>> 
>>> pws
> It doesn't seem to solve the problem.  Here's a real example:
> 
> $ g ,H 'execute' 'g,46,w4 now default' f
> ... The search string is 'execute' and the two target files follow. But after zsh is finished stripping of the quotes the final grep command looks like this:
> 
> GREP_COLOR='01;33' grep --color=always -iFIHn -d skip -- 'execute' g,46,w4 now default  f
> 
> ... and of course it won't work due to the spaces.  Input via an array seems to make no difference.  (Unless I'm doing it wrong.)  If I do this:
> 
> $ g ,H 'execute' 'g,46,w4\ now\ default' f
> ... I get:
> 
> GREP_COLOR='01;33' grep --color=always -iFIHn -d skip -- 'execute' g,46,w4\ now\ default  f
> ... which works fine.  Finally,:
> 
> $ g ,H 'execute' g,46,w4\ now\ default f
> ... gives:
> 
> GREP_COLOR='01;33' grep --color=always -iFIHn -d skip -- 'execute' g,46,w4 now default  f
> ... and again the unquoted spaces screw it up.  Is there any way to force the single quotes to pass through as literals?

How are you assembling the grep command? How are you executing it?

> Lawrence:
> 
> It's all rather complicated, my wrappers do all sorts of mischief before calling grep.

For the less clairvoyant of us, your refusal to reveal anything but
the smallest slice of your actual code makes it rather difficult
to help.

vq

  reply	other threads:[~2021-02-10  0:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 20:42 Ray Andrews
2021-02-09 21:05 ` Lawrence Velázquez
2021-02-09 21:08 ` Peter Stephenson
2021-02-09 23:45   ` Ray Andrews
2021-02-10  0:22     ` Lawrence Velázquez [this message]
2021-02-10  0:51       ` Ray Andrews
2021-02-10  1:46         ` Lawrence Velázquez
2021-02-10  2:25           ` Ray Andrews
2021-02-10  2:52             ` Lawrence Velázquez
2021-02-10  1:52         ` Greg Klanderman
2021-02-10  2:29           ` Ray Andrews
2021-02-10 15:18           ` Ray Andrews
2021-02-10 15:47             ` Peter Stephenson
2021-02-10 16:19               ` Ray Andrews
2021-02-10 16:29                 ` Peter Stephenson
2021-02-10 20:53                   ` Ray Andrews
2021-02-10 22:14                     ` Bart Schaefer
2021-02-11 16:31                       ` Ray Andrews
2021-02-11 17:19                         ` Lawrence Velázquez
2021-02-11 19:48                           ` Ray Andrews
2021-02-10 18:08                 ` Bart Schaefer
2021-02-10 20:56                   ` Ray Andrews
2021-02-10 16:28             ` Lawrence Velázquez

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=52D5DA56-397F-40BB-BBA7-CE3BF7256581@larryv.me \
    --to=vq@larryv.me \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).