From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id f7a5349a for ; Sun, 19 May 2019 18:33:01 +0000 (UTC) Received: (qmail 1961 invoked by alias); 19 May 2019 18:32:51 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44327 Received: (qmail 5982 invoked by uid 1010); 19 May 2019 18:32:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25454. spamassassin: 3.4.2. Clear:RC:0(209.85.210.41):SA:0(-1.7/5.0):. Processed in 4.299259 secs); 19 May 2019 18:32:51 -0000 X-Envelope-From: phy1729@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.210.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bRTQjECF0E1YJDbe3T6T6ThVtNFozwID35vRO3CC5uQ=; b=g6a8+ZaB9TKjXK4OK0B6NQ6vztggbvlJzIphigdNuLqPhydiB6KGilBWTpB842tSH1 xsQAJ4Y21fsJ6Q6lORa3SMj27hrODXxnXmc06shKvENdtqpcbcSWtPrZXPrwczfTTD6U OwRP+QYAAaWpmY4IBidguWMLhBofO2GKexClldO6COPjECPdOSX0lxQ+ipr/KZNAV+H9 S7VpOFFO/A5noky9HZ6O19GSHXmBLSzdUz8b9lTZ05gKc7MEPHijrKIoGKjO89o5tjn0 R2UCsOySVZwTUC0k+4tLgp1pRfsAY3tu3vwkkRN1do8XvmS6D27gPqwxHZXZRDzmi8Ly 9wZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=bRTQjECF0E1YJDbe3T6T6ThVtNFozwID35vRO3CC5uQ=; b=QuYBAPM20T+wvvbfYupZGj7gnoV8iml5US5rTVMbwqOFSCRcXm3zbnyTBcMeDhKIto HmXGtiX5vd7rKOdYAGqt9JAB51JD4EeKMxbnhn20EjN3MtnDZy3kXfDAmbiNVTAQJo30 sxRn+KdXjG8kxoUZFBZpYWzrp+w7euveW3fGq3Bj4RNZe3KmS3X1x25AS5iCtdhmLRwI hq60ysqZdxfXKrxXzX2hALZg13B6sUe+TOKmTokpQWxPtv+pVuNxedXM53GisIzyJyOQ Xin/Y3X0m+AcpbYdl5zeexLgbuCM0eFNe7BSEPe/8ItX+Bw1l1VqcOVXbOrtZvafT763 uYIQ== X-Gm-Message-State: APjAAAVz92thsi1xuQiEWcuHYEtkctlwpItgzY2YocDmOlBDxU2WbfcF 9nDV6WwgItzokJznF5mXyWE= X-Google-Smtp-Source: APXvYqyE4vicqTsPiq86s+W0N7mEv3nH04MKhto6wRqmzVFseR8PFkvY62JekxUl8agjrcfQio8tuQ== X-Received: by 2002:a9d:5618:: with SMTP id e24mr12989126oti.38.1558290733863; Sun, 19 May 2019 11:32:13 -0700 (PDT) Date: Sun, 19 May 2019 13:32:11 -0500 From: Matthew Martin To: Sam Houston Cc: zsh-workers@zsh.org Subject: Re: Git grep command not interpreting flags correctly when an argument Message-ID: <20190519183210.GA47046@CptOrmolo.darkstar> Mail-Followup-To: Sam Houston , zsh-workers@zsh.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) On Sun, May 19, 2019 at 07:09:22PM +0100, Sam Houston 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 better way (both in zsh and in bash) would be to use an array. flags=(--untracked --color) git grep "${flags[@]}" pattern # git grep $flags pattern would also work, but just in zsh Relying on word splitting means that arguments that contain spaces or other IFS characters are mangled into two or more arguments.