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 ;-)