[TUHS] sh and goto

Ken Thompson kenbob at gmail.com
Wed Dec 16 05:44:39 AEST 2020


it was the right thing to do.
wish i had thought of it.
i was too busy saving bytes.


On Tue, Dec 15, 2020 at 8:03 AM srbourne <srbourne at gmail.com> wrote:

> Message: 4
>
> Date: Mon, 30 Nov 2020 19:59:18 -0800 (PST)
> From: jason-tuhs at shalott.net
> To: tuhs at minnie.tuhs.org
> Subject: Re: [TUHS] The UNIX Command Language (1976)
> Message-ID:
> 	<alpine.LRH.2.23.453.2011301946410.14253 at waffle.shalott.net> <alpine.LRH.2.23.453.2011301946410.14253 at waffle.shalott.net>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
>
>
> "The UNIX Command Language is the first-ever paper published on the Unix
> shell. It was written by Ken Thompson in 1976."
> https://github.com/susam/tucl
>
> Thanks for that.
>
> This reminded me that the Thompson shell used goto for flow control, which
> I had forgotten.
>
> Bourne commented on the omission of goto from the Bourne shell, "I
> eliminated goto in favour of flow control primitives like if and for.
> This was also considered rather radical departure from the existing
> practice."
>
> Was this decision contentious at all?  Was there a specific reason for
> goto's exclusion in the Bourne shell?
>
>
> Thanks.
>
>
>   -Jason
>
>
> At the time it may have raised a few eyebrows but I don't recall much discussion about it then.  My email tracks at the time don't mention it.
> Doug McIlroy or Steve Johnson (or Ken) on this forum might recall differently.  At the time scripts were not that complicated and so error recovery to a far off place in the script was not common.  As an aside I did persuade Dennis to add "setjmp" and "longjmp" so the shell code itself could recover from some kinds of script errors.
> So I did not have a "religious" aversion to "goto" at the time.
>
> Steve
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20201215/3712a2f0/attachment.htm>


More information about the TUHS mailing list