Questions about rewriting the History function.

Bill Stewart 201-949-0705 erebus.att.com!wcs wcs at cbnewsh.att.com
Sun Oct 21 11:02:05 AEST 1990


In article <1990Oct19.165721.7584 at polyof.poly.edu>, roseann at polyof.poly.edu,
(RoseAnn Ammendolea) (or Marc someone using her account?) writes:
] I am working on a senior project to rewrite the history function for UNIX.
] My goal is to have the new history function work like it does in
] MS_DOS.  i.e. I want to be able to call up past commands and edit them
] by using the control <hjkl> characters.  Additionally, I would like to
] write this as a stand alone program so that I do not have to rewrite the shell.

The main problem is that UNIX doesn't process or remember the command lines,
(except to the crude extent that the accounting system does) -
it's all done by the shell.  The commands you type are simply input
to the shell, which does any interpretation, and fork()/exec()s the
command if it's a "real" command, or just does it if it's a shell builtin.

Depending on what shell you use, it may or may not have a history
capability, and that history may be stored in a file or in memory.
If it's in a file, it may not be absolutely up-to-date.
You'll have to play around with shells you like, and you really need source.

The old Bourne shell (/bin/sh) doesn't do history.
The C shell does, with the ugly !! command-based interface.
The Korn shell (ksh) does history, stores it in a file, and gives
	you an editor-interface as well as a command-based interface.
Various intellectual derivatives like BASH and tcsh are similar.
The 9th edition shell gave you something lean, mean, and clean, as always.
The adventure shell doesn't have history, but it has xyzzy. :-)

MS-DOS itself doesn't have a 'history' command.  The F1 and F3 keys
let you get the most recent command, unless it's been trashed;
I think this is managed by command.com rather than DOS.
There are a couple of history commands running around, including
HISTORY and ANARKEY; don't know if any of them come with source.

The other good thing about VMS, besides HELP, was command editing.
It probably only worked for VT100 terminals, but it was there and easy.

			Good luck
-- 
					Thanks; Bill
# Bill Stewart 908-949-0705 erebus.att.com!wcs AT&T Bell Labs 4M-312 Holmdel NJ
Government is like an elephant on drugs: It's very confused, makes lots of noise,
can't do anything well, stomps on anyone in its way, and it sure eats a lot.



More information about the Comp.unix.questions mailing list