Code

t7810: avoid unportable use of "echo"
authorJunio C Hamano <gitster@pobox.com>
Mon, 20 Jun 2011 21:49:34 +0000 (14:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jun 2011 21:49:34 +0000 (14:49 -0700)
Michael J Gruber noticed that under /bin/dash this test failed
(as is expected -- \n in the string can be interpreted by the
command), while it passed with bash.  We probably could work it
around by using backquote in front of it, but it is safer and
more readable to avoid "echo" altogether in a case like this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7810-grep.sh

index 69bd576d1c1a0bfcd086b68d8dc07c03c22b7a5a..6379ad60bcb9b5b56eb773b5a987745356c24df6 100755 (executable)
@@ -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
 '