git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Avoid using non-portable `echo -n` in tests.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 31, 2008, 14:32 UTC
Message-ID
<20081031143200.GR14786@spearce.org>
In-Reply-To
<1225429753-70109-1-git-send-email-benji@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> wrote:
> Not all /bin/sh have a builtin echo that recognizes -n.  Using printf
> is far more portable.
Show 10 quoted lines
> diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
> index c1850d2..f6a2dbd 100755
> --- a/t/t9400-git-cvsserver-server.sh
> +++ b/t/t9400-git-cvsserver-server.sh
> @@ -424,7 +424,7 @@ cd "$WORKDIR"
>  test_expect_success 'cvs update (-p)' '
>      touch really-empty &&
>      echo Line 1 > no-lf &&
> -    echo -n Line 2 >> no-lf &&
> +    printf Line 2 >> no-lf &&
That needs to be:
	printf 'Line 2'

to have the same result. Fortunately I don't think it matters in this test, but it does read odd.

-- 
Shawn.
Previous: Steve FollyNext: Jeff King
Message 9 of 15 in “t4030: Don't use echo -n”
  1. t4030: Don't use echo -nBrian Gernhardt, Oct 30, 2008
  2. Ian HiltOct 30, 2008
  3. Brian GernhardtOct 31, 2008
  4. Avoid using non-portable `echo -n` in tests.Brian Gernhardt, Oct 31, 2008
  5. Junio C HamanoOct 31, 2008
  6. Brian GernhardtOct 31, 2008
  7. Junio C HamanoOct 31, 2008
  8. Steve FollyOct 31, 2008
  9. Shawn O. PearceOct 31, 2008
  10. Jeff KingOct 31, 2008
  11. Pierre HabouzitOct 31, 2008
  12. Jeff KingOct 31, 2008
  13. Francis GaliegueOct 31, 2008
  14. Johannes SchindelinOct 31, 2008
  15. Mike RalphsonNov 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.