zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Sam Houston <sehouston3@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Git grep command not interpreting flags correctly when an argument
Date: Sun, 19 May 2019 20:14:15 +0200	[thread overview]
Message-ID: <CAN=4vMqp_2co2z5SimayHNkXnLrN2Aq1W1XC--sZcj=AeWhsiQ@mail.gmail.com> (raw)
In-Reply-To: <CADbM1Mo6iqa=YcEFCw67FVOhZisX9ioBsdtzTcVmjEOgErebtA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]

ZSH doesn't perform word splitting by default, so `git grep $FLAGS pattern`
in ZSH is equivalent to `git grep "$FLAGS" pattern` in bash. You can
explicitly request word-slitting via `$=FLAGS`. There is also an option to
do this automatically but it's not a good idea to turn it on. Most of the
time you really don't want word splitting when you type $FOO.

Roman.

On Sun, May 19, 2019 at 8:10 PM Sam Houston <sehouston3@gmail.com> wrote:

> In a `bash` shell, in some empty directory, I can run the commands:
>
> ```bash
> git init
> echo "pattern" > file.txt
> FLAGS="--untracked --color"
> git grep $FLAGS pattern
> ```
>
> And see the output:
>
> ```
> file.txt:pattern
> ```
>
> But in a `zsh` shell, when I run the same commands, I get the following
> error:
>
> ```
> error: unknown option `untracked --color'
> ```
>
> The error only seems to occur when I pass in with more than one `--` in the
> `FLAGS` variable.
>
> My `zsh --version` is `zsh 5.3 (x86_64-apple-darwin18.0)`.
>
> Let me know if I am doing something wrong, or if you need more information.
>
> Thanks,
>
> Sam
>

  reply	other threads:[~2019-05-19 18:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-19 18:09 Sam Houston
2019-05-19 18:14 ` Roman Perepelitsa [this message]
2019-05-19 18:32 ` Matthew Martin
2019-05-19 19:42   ` Sam Houston

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='CAN=4vMqp_2co2z5SimayHNkXnLrN2Aq1W1XC--sZcj=AeWhsiQ@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=sehouston3@gmail.com \
    --cc=zsh-workers@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).