Re: [PATCH v7] ls-files: introduce "--format" option
Junio C Hamano <gitster@pobox.com> 于2022年7月20日周三 00:47写道:
Show 33 quoted lines
>
> ZheNing Hu <adlternative@gmail.com> writes:
>
> > Ævar Arnfjörð Bjarmason <avarab@gmail.com> 于2022年7月18日周一 16:29写道:
> >>
> >>
> >> On Wed, Jul 13 2022, ZheNing Hu via GitGitGadget wrote:
> >>
> >> > +test_expect_success 'setup' '
> >> > + printf "LINEONE\nLINETWO\nLINETHREE\n" >o1.txt &&
> >> > + printf "LINEONE\r\nLINETWO\r\nLINETHREE\r\n" >o2.txt &&
> >> > + printf "LINEONE\r\nLINETWO\nLINETHREE\n" >o3.txt &&
> >>
> >> If you want to do this sort of thing in general this pattern is better:
> >>
> >> x="a b c" &&
> >> printf "%s\n" $x
> >> printf "%s\r\n" $x
> >>
> >
> > Let see what's these cmd output:
> >
> > x="a b c" &&
> > printf "%s\n" $x &&
> > printf "%s\r\n" $x
> >
> > a b c
> > a b c
>
> The above makes it look as if your shell is broken or you have an
> unusual IFS that does not have space in it. Are you sure you did
> not place anything around $x on the second and the third line, which
> is given to printf after its contents split into words at $IFS?
Ok... That's zsh's strange feature.... I turn to use bash, it's find.