From: Jeff King Date: Tue, 18 Jun 2013 05:54:39 GMT Subject: Re: [PATCH v2 02/13] bash prompt: fix here document indentation in interactive rebase test Message-ID: <20130618055439.GD5916@sigill.intra.peff.net> In-Reply-To: <1371521826-3225-3-git-send-email-szeder@ira.uka.de> On Tue, Jun 18, 2013 at 04:16:55AM +0200, SZEDER Gábor wrote: > - echo "#!$SHELL_PATH" >fake_editor.sh && > - cat >>fake_editor.sh <<\EOF && > -echo "exec echo" >"$1" > -echo "edit $(git log -1 --format="%h")" >>"$1" > -echo "exec echo" >>"$1" > -EOF > + cat >fake_editor.sh <<-EOF && > + #!$SHELL_PATH > + echo "exec echo" >"\$1" > + echo "edit \$(git log -1 --format="%h")" >>"\$1" > + echo "exec echo" >>"\$1" > + EOF These days we the "write_script" helper, so I think you can write this even nicer as: diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index 9e51263..91da313 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -248,14 +248,12 @@ EOF test_expect_success 'prompt - interactive rebase' ' printf " (b1|REBASE-i 2/3)" >expected - echo "#!$SHELL_PATH" >fake_editor.sh && - cat >>fake_editor.sh <<\EOF && -echo "exec echo" >"$1" -echo "edit $(git log -1 --format="%h")" >>"$1" -echo "exec echo" >>"$1" -EOF + write_script fake_editor.sh <<-\EOF && + echo "exec echo" >"$1" + echo "edit $(git log -1 --format="%h")" >>"$1" + echo "exec echo" >>"$1" + EOF test_when_finished "rm -f fake_editor.sh" && - chmod a+x fake_editor.sh && test_set_editor "$TRASH_DIRECTORY/fake_editor.sh" && git checkout b1 && test_when_finished "git checkout master" && -Peff