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

Re: [PATCH] p3400: stop using tac(1)

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 7, 2021, 23:44 UTC
Message-ID
<xmqqzgrkmmd7.fsf@gitster.g>
In-Reply-To
<a3377973-4f4a-376a-f02e-94a3b20dd9ad@web.de>
René Scharfe <l.s.r@web.de> writes:
> In my mind, test is an external command.  Wikipedia [1] says it has been
> a builtin since the early 80ies, and I couldn't find a shell without it.
> I wonder where I picked up that outdated assumption -- I'm not actually
> _that_ old.  Time for an update..

Funny, as I was wondering about the same thing the other day in a totally different context.

Our older shell script (like tests) tends to strongly prefer "case ... esac" over "test" for this exact reason, e.g option parsing loop often uses

    while case $#,$1 in 0,*) break ;; *,-*) ;; *) break ;; esac
    do
	...
instead of
    while test $# -gt 0 && ...

to avoid "test". I'm not actually _that_ old, either, but my current suspicion is that those who traind us are old enough ;-)

Previous: René Scharfe
Message 7 of 7 in “p3400: stop using tac(1)”
  1. p3400: stop using tac(1)René Scharfe, Oct 2, 2021
  2. Jeff KingOct 4, 2021
  3. René ScharfeOct 5, 2021
  4. Jeff KingOct 5, 2021
  5. René ScharfeOct 5, 2021
  6. René ScharfeOct 7, 2021
  7. Junio C HamanoOct 7, 2021

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.