a bit more on ksh
Gary Perlman
gsp at ulysses.UUCP
Sun Jun 10 10:51:12 AEST 1984
> Does the Korn shell spawn a new vi or emacs process every time you want
> to edit some command in the history list? This strikes me as inefficient,
> particularly on architectures where forking is slow. Or does ksh have
> a subset of vi built in? This strikes me as an inefficient use of memory,
> and a long-term maintenance problem.
As was posted, ksh has subsets of vi and emacs commands so that the user works
with a one line editor. Lines that are too long are scrolled. The editing
mechanism uses smarts rather than any sort of termcap information; even dumb
terminals are supported. At 300 baud, I suspect some operations would be
tedious (like inserting a character at the beginning of a full line).
In most cases, this does not happen. In vi mode, (set by the $EDITOR
or $VISUAL environment variable), no input line editing is done until
the user hits ESC. On several of our machines, ksh has been installed
as /bin/sh. Many users are not aware that they have line editing capabilities;
they do not have to be, and there is no penalty (other than object size)
for the editing capabilties. The maintenance problems seem to have long
gone away.
> I've always thought ^K (vertical tab) would be a good way to bring down
> a character at a time of the previous command. Tandem's OS has a feature
> like this. Most people think the ^^^ and !!:gs substitutions of csh are
> awkward-- who really knows what type of regular expressions are used there?
> Calling vi or emacs seems like overkill-- in most cases a good typist can
> rekey the line before vi (let alone emacs) starts up. But with the method
> proposed here, you could hold down ^K (using erase if necessary) until you
> want to insert something, type it, then press ^K again until you're done.
> The code to implement ^K would certainly be smaller than the code to handle
> csh history substitutions. No changes to the tty driver are required.
At UCSD, we had a command called ec that would put !! or !pattern into
a file, call ex +o on it, and push the result onto the keyboard queue.
Cute, but really slow. KSH editing, even things like pattern searches
through the history file are pretty good: usually immediate.
While a simpler editor would reduce code size, I bet a lot of people
would miss having most of their favorite edit commands. Suppose I
did a complicated nroff on FILE.1 a while back, I type ESC/nroff RETURN,
and that line is in my buffer, I would probably then type $b to get
to the beginning of the last word and change that word with cwFILE.2 ESC.
I could hit RETURN then, or before the ESC, unquoted newlines transmit the line.
> how come C&P TelCo can get hold of unreleased Bell Labs software.
> I thought the Bell System had been outlawed by Judge Green.
Pardon me if I use the incorrect terms, but the operating companies
supported a large percentage of the work at Bell Labs, and so, Green
ruled, they have a right to the work developed there. Also, it was ruled,
because of the seed planted there by this investment, they have certain
rights to ongoing developments at AT&T. Which rights? I'm not sure.
> Would someone out there mind sending me a fairly detailed description of
> how ksh's "emacs mode" and "vi mode" look to the user? At BBN I've made
> some enhancements to the Bourne shell so that it knows about CRTs and
> behaves a little like an emacs type editor. (It also has aliases, but no
> job control and no extensions to the shell "language".)
KSH has aliases, somewhat like csh, not like vi's map command.
KSH does have csh like job control for those systems that support it.
The extensions to the shell language include a lot of built-ins,
like arithmetic, eval, text, pwd, etc., a menu option to get user inputs.
I'm pretty sure there are others.
> I would be very interested in hearing about how ksh handles CRTs and what
> a session with ksh in emacs mode looks like. Mr. Korn must have looked
> at a lot of the same issues I did and I am curious about what the results
> look like.
There is some of this above.
Gary Perlman BTL MH 5D-105 (201) 582-3624 ulysses!gsp
More information about the Comp.unix
mailing list