🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #422

Re: The road not taken

#422
From: Lawrence D’Oliveiro
Date: Fri, 27 Nov 2026 00:36
35 lines
2727 bytes
On Fri, 27 Nov 2026 00:15:20 -0000 (UTC), Christian Weisgerber wrote:

> On 2026-11-26, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
>
>>> Anyway, I took a peek at V6, and found this gem in the find(1) man
>>> page:
>>>
>>>   BUGS
>>>        Syntax should be reconciled with _if_.
>>
>> How was that supposed to work, exactly? “if” is a shell builtin,
>
> In V6 it wasn't.
> https://man.freebsd.org/cgi/man.cgi?query=if&manpath=Unix+6th+Edition
>
> This was before the Bourne shell introduced ALGOL-style flow control
> to the shell. The V6 sh(1) had to make do with if(1) and goto(1),
> both implemented as external commands. Yes, external goto.

So, the “road not taken” was really keeping them as external commands.
The only reason this was changed was that the old approach was just
too clunky for words. Would you like to revive that idea in a shell
now?

> But even in the Bourne world, _if_ just runs a command and acts on
> the exit code. test(1) and its alias [ have been implemented as
> external commands, and even when they are builtins, they still obey
> the syntactic restrictions of an external command.

See the separation of functions here: “if” just meant “take action
depending on exit code”. “test”/“[” then became the mechanism for
“compute an arbitrary conditional expression and return an exit code
accordingly”, dovetailing nicely into the role of “if”.

The old “do one thing, and do it well” motif, yet again ...
Technical Details
Message-ID: <11eajar$16iu7$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <slrn11gh1gh.eig.naddy@lorvorc.mips.inka.de> <11ea75s$1268g$3@dont-email.me> <slrn11ghiso.klm.naddy@lorvorc.mips.inka.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.unix.shell
Subject: Re: The road not taken
Date: Fri, 27 Nov 2026 00:36:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <11eajar$16iu7$1@dont-email.me>
References: <slrn11gh1gh.eig.naddy@lorvorc.mips.inka.de>
	<11ea75s$1268g$3@dont-email.me> <slrn11ghiso.klm.naddy@lorvorc.mips.inka.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 27 Nov 2026 00:36:44 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1264583"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/0iwxjd3mF1THcdKJENURv"; posting-host="2e959dcef4deb5b603b340204973c717"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:qROhwVutw9//x7ZX0OUyCxzQYk8= sha256:R5apNCi7BIFunIhnIHyU5uBQF/cx060UECXuPKcibi0=
	sha1:+bzs0NVdFe7W4v4jt2xYdm5+CfA= sha256:ClY5AEeSVoaIUxQVXlDI8zPTa5nvTucBZrvOOEt06Ac=