[comp.unix.questions] Retrieve keyboard commands like VM/CMS

joc@vax5.cit.cornell.edu (11/02/90)

Is there a way to retrieve previously typed commands in UNIX similar
to the way IBM's VM/CMS does it, ie, hit the retrieve key and the
previous command appears and may now be edited on the command line?

Alan Wenban
wenban@ee.cornell.edu

gwyn@smoke.brl.mil (Doug Gwyn) (11/02/90)

In article <1990Nov1.121612.724@vax5.cit.cornell.edu> joc@vax5.cit.cornell.edu writes:
>Is there a way to retrieve previously typed commands in UNIX similar
>to the way IBM's VM/CMS does it, ie, hit the retrieve key and the
>previous command appears and may now be edited on the command line?

Similar functionality has been implemented in several versions of both
the Bourne/Korn shell and the C-shell, and there have also been some
separate interactive editing "wrappers" posted in the past.  Many
terminals and windowing systems now support interactive mouse-driven
edit-displayed-text-and-send-as-though-typed; the AT&T 630 I'm typing
this one has such a feature.

If you have a UNIX System V Release 2 or later source license and send
a copy of it to me along with a reel of 1/2" magtape, I can put the
sources for the BRL version of the Bourne shell on it and return it to
you.  Our version supports essentially all the useful user-interface
features found in various enhanced Bourne/Korn and C- shells, without
some of the unnecessary baggage.  I'm sure you can also find ways to
obtain "bash", "tcsh" (yuck), and other enhanced shells.  Have fun.

jeffs@bcs800.UUCP (Jeff Smith) (11/03/90)

In <1990Nov1.121612.724@vax5.cit.cornell.edu> joc@vax5.cit.cornell.edu writes:

>Is there a way to retrieve previously typed commands in UNIX similar
>to the way IBM's VM/CMS does it, ie, hit the retrieve key and the
>previous command appears and may now be edited on the command line?

Try using the K Shell (ksh), it supports command line editing using
the vi editing commands, maybe even other editors like emacs.

Both Bourne and C-shell do not support command line editing that I know
of.

jeffs
--
Jeff Smith                  | #include <stdDisclaimer.h>
Brock Control Systems       | uucp: ...!gatech!emory!bcs800!jeffs
Technical Support           | bitnet: hadadax@gsuvm1.bitnet
                            | jiffy: length of time it takes me to solve
tel: +800 444 3070          |      your problem by killing your process.

prc@erbe.se (Robert Claeson) (11/04/90)

In a recent article jeffs@bcs800.UUCP (Jeff Smith) writes:

>Try using the K Shell (ksh), it supports command line editing using
>the vi editing commands, maybe even other editors like emacs.

Sure, aside from vi editing, it supports both Gnu and Gosling
emacs editing. For those who don't have ksh or can't get it,
an alternative might be the partially ksh-compatible "bash" from
the Free Software Foundation.

-- 
Robert Claeson                  |Reasonable mailers: rclaeson@erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se@sunet.se
                                |  Perverse mailers: rclaeson%erbe.se@encore.com
These opinions reflect my personal views and not those of my employer.

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (11/04/90)

In article <1990Nov1.121612.724@vax5.cit.cornell.edu> joc@vax5.cit.cornell.edu writes:
> Is there a way to retrieve previously typed commands in UNIX similar
> to the way IBM's VM/CMS does it, ie, hit the retrieve key and the
> previous command appears and may now be edited on the command line?

Check out pmlined 1.5, just posted to alt.sources. It gives you
command-line editing on your status line, just like good old VM/CMS.
With ^B and ^F you can flip back and forth through recent commands and
edit them to be sent through again. That should be what you want. You
can use pmlined with any application, not just your favorite shell.

Other keys: ^H and ^L give you left-right motion within the line.
Characters typed are inserted, and long lines are scrolled horizontally,
with arrows indicating unseen chunks. Delete erases to the left. ^W
erases a word; ^U erases the entire line to the left. ^A toggles between
edit (and history) mode and sending characters through to the native tty
driver. ^V lets you enter any character literally. ^D sends the current
part-line through, and exits if the application receiving its output
does.

pmlined is just a few hundred lines, proving that line disciplines don't
have to be hard to program. Feel free to modify it to your taste. It
should work anywhere pty is installed.

---Dan