From: Eric Sunshine Date: Wed, 15 Feb 2023 00:34:46 GMT Subject: Re: [PATCH v4 3/3] t4113: put executable lines to test_expect_success Message-ID: In-Reply-To: <230208.865ycc1tqc.gmgdl@evledraar.gmail.com> On Wed, Feb 8, 2023 at 2:57 AM Ævar Arnfjörð Bjarmason wrote: > In this case the syntax you're trying to get working is something we > usually try to avoid in either case, i.e. even if it involves an > external process we usually do: > > cat >out <<-\EOF > a > b > c > EOF > > Rather than: > > echo "a > b > c" >out The here-doc (<<-\EOF) form is definitely a good idea when the code is part of an indented test body, whereas the multi-line double-quoted string will be problematic since lines "b" and "c" will be indented with TAB, which is undesirable here. Even better for such a simple case would be: test_write_lines a b c >out && In fact, Junio made this suggestion in the form of a code snipped much earlier in this thread. > If you are using "echo" I saw another change of yours had e.g.: > > echo x >f && > echo y >>f && > echo z >>f > > It's better to e.g. (assuming use of "echo", or other built-ins or > commands): > > { > echo x && > echo y && > echo z > } >f This is also an improvement, though test_write_lines would (again) be even better for such a simple case: test_write_lines x y z >f &&