Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Git grep command not interpreting flags correctly when an argument
- X-seq: zsh-workers 44326
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Sam Houston <sehouston3@xxxxxxxxx>
- Subject: Re: Git grep command not interpreting flags correctly when an argument
- Date: Sun, 19 May 2019 20:14:15 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ErW1mo8Lfl55A1QTMqnXgDl9/o9NoqoVaaBh12dhyPY=; b=R+SfMPP5IYqHHRrCfovoEaWsY75FXkxxwmRly+/d4C2bAgdLEQCehIvzjblc1qf2zE fd3m1vtBDjU59F/eV55PjIbsTSqFAGPiAiCkgDIVg3qWFlcliHdO+hYvvOOCx4d9Yowh tOruB9ssSe+alQ+x8UzPFfx7vRZuhLuofhDQNQv1yVVHy99zf/9JNRQLgobKXK1wJs57 BE4icmtwqGmFXc1+H5JV8fapdk+eTbRqI44yPtzXk17GxZCG3203VDqkGUsbBjW3iIcE LZptda3lQWXkrm2jKBUDWEMYDfAWRHJw/LSzVPtNlQ7qqgdlekEpshr9C0mfm/erMSgd jDXg==
- In-reply-to: <CADbM1Mo6iqa=YcEFCw67FVOhZisX9ioBsdtzTcVmjEOgErebtA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CADbM1Mo6iqa=YcEFCw67FVOhZisX9ioBsdtzTcVmjEOgErebtA@mail.gmail.com>
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@xxxxxxxxx> 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
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author