Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: view onto command pipeline?



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




Messages sorted by: Reverse Date, Date, Thread, Author