zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: zsh-users@zsh.org
Subject: Re: view onto command pipeline?
Date: Wed, 20 Jul 2022 13:35:43 +0100	[thread overview]
Message-ID: <Ytf2n57VHRJg54Re@gmx.de> (raw)
In-Reply-To: <978d1a3f-8d21-6a2b-02c4-4e7c56e6ee72@luffy.cx>

On Wed, Jul 20, 2022 at 02:22:21PM +0200, Vincent Bernat wrote:
> On 2022-07-20 13:37, Dominik Vogt wrote:
> > On Wed, Jul 20, 2022 at 07:23:46AM -0400, Anthony Heading wrote:
> > >          local opts=()
> > >          if [[ -o interactive && ( -t 1 || -n $pager ) ]]
> > >          then
> > >                  opts=(-c color.ui=always)
> > >          fi
> > >          command git $opts $@
> >
> > For proper handling of whitecpace in options and arguments:
> >
> >    command git "${opts[@]}" "$@"
> >
> > Otherwise, if you have, say, files "a", "b" and "a b",
> >
> >    $ git commit "a b"
> >
> > Would commit a and b but not "a b" if the $@ is not quoted.  As a
> > rule of thumb, _never_ use unquoted variables in shell scripts.
>
> I don't think this is true for Zsh.
>
>  14:21 ??? f() { print -l $@ }
>  14:21 ??? f a b
> a
> b
>  14:21 ??? f "a b"
> a b

Depends on shell options:

  $ function xls () { command ls $@ }
  $ setopt shwordsplit
  $ xls "a b"
  ls: cannot access 'a': No such file or directory
  ls: cannot access 'b': No such file or directory
  $ unsetopt shwordsplit
  $ xls "a b"
  'a b'

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


  reply	other threads:[~2022-07-20 12:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16 16:15 Anthony Heading
2022-07-16 21:30 ` Bart Schaefer
2022-07-20 11:23   ` Anthony Heading
2022-07-20 11:37     ` Dominik Vogt
2022-07-20 12:22       ` Vincent Bernat
2022-07-20 12:35         ` Dominik Vogt [this message]
2022-07-20 19:07           ` Lawrence Velázquez
2022-07-21  0:15       ` Anthony Heading
2022-07-21  1:35         ` Lawrence Velázquez
2022-07-21  2:11           ` Anthony Heading
2022-07-21  3:15             ` Lawrence Velázquez
2022-07-21  6:43             ` Dominik Vogt
2022-08-04 21:12             ` Felipe Contreras
2022-07-20 19:27     ` Phil Pennock
2022-07-21  0:18       ` Anthony Heading

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=Ytf2n57VHRJg54Re@gmx.de \
    --to=dominik.vogt@gmx.de \
    --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).