Re: POSIX woes in t7810.87: dash bash or bash dash?

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: POSIX woes in t7810.87: dash bash or bash dash?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:30

Thanks for noticing. Let's do this.

 t/t7810-grep.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 69bd576..6379ad6 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -658,9 +658,9 @@ test_expect_success LIBPCRE 'grep -P -v pattern' '
 '
 
 test_expect_success LIBPCRE 'grep -P -i pattern' '
-	{
-		echo "hello.c:	printf(\"Hello world.\n\");"
-	} >expected &&
+	cat >expected <<-EOF &&
+	hello.c:	printf("Hello world.\n");
+	EOF
 	git grep -P -i "PRINTF\([^\d]+\)" hello.c >actual &&
 	test_cmp expected actual
 '

Re: POSIX woes in t7810.87: dash bash or bash dash?

From: Jeff King <hidden>
Date: 2016-06-15 22:51:30

On Mon, Jun 20, 2011 at 02:46:08PM -0700, Junio C Hamano wrote:
quoted hunk
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 69bd576..6379ad6 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -658,9 +658,9 @@ test_expect_success LIBPCRE 'grep -P -v pattern' '
 '
 
 test_expect_success LIBPCRE 'grep -P -i pattern' '
-	{
-		echo "hello.c:	printf(\"Hello world.\n\");"
-	} >expected &&
+	cat >expected <<-EOF &&
+	hello.c:	printf("Hello world.\n");
+	EOF
Do you need to quote EOF to suppress expansion in the here document?
Both bash and dash seem to pass unknown backslash-escapes like "\n"
through unharmed, but I don't know if that is portable (they do both
munge known escapes like "\\", of course).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help