[TUHS] v7 source code for sh

Chet Ramey chet.ramey at case.edu
Mon Feb 21 06:54:12 AEST 2022


On 2/19/22 6:11 PM, Sven Mascheck wrote:

> keyword history: I always imagined that the Bourne shell would have been in 
> much wider use even nowadays, if only it had provided line editing and a 
> history at some point. Why not? 

I think it's that the people with the power to make it happen didn't view
it as an appropriate feature for the shell.

It was much easier to implement in the shell, both technically and
socially. Instead of having to convince kernel developers to implement and
maintain editing in the terminal driver (both emacs and vi modes, to boot),
it's easier for one person, maybe a few, to do a user-space implementation.
That's how it ended up in ksh, for instance.

Rob already talked about the Blit editing, which obviated the need to have
it in the shell.


> Even Kenneth Almquist released his 
> SVR4-like reimplementation intentionally without history.

Almquist released `atty' the same time as `ash', so he did at least provide
a way to do editing and history using ptys, in the same way that `rlwrap'
wraps readline.

But he decried its lack of "elegance," and described it as something that
"should be rewritten properly, with appropriate kernel support."


> All that might 
> have been implemented more elegant directly in the terminal I/O instead of 
> in every program? (that is, not in a MS-DOS-like way, where every program 
> even needs its own pager).

Elegant, maybe, but it never seemed to take off. There were a few different
implementations, but none was ever blessed as something officially
integrated into a widely-distributed kernel. (As I recall, Jon Payne, who
wrote JOVE while in high school (!), wrote one as a college course project.
I remember him describing it on Usenet back in the day. There were others.)

It always seemed like it would have been just the thing to implement as a
tty streams module, but research Unix went in a different direction.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/


More information about the TUHS mailing list