From: Junio C Hamano Date: Tue, 19 Jul 2022 16:47:52 GMT Subject: Re: [PATCH v7] ls-files: introduce "--format" option Message-ID: In-Reply-To: ZheNing Hu writes: > Ævar Arnfjörð Bjarmason 于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?