[comp.unix.questions] history file sharing in ksh

jack@cs.glasgow.ac.uk (Jack Campin) (02/10/89)

Does anyone know what protocol ksh uses for sharing the history file when
running multiple sessions?  I cannot make sense of what I see happening.  Does
it act differently for shells run from distinct NFS clients than when all
shells are on the same machine?  Is there any concurrency control at all?
(Then again, this is on Suns, and given the dog's breakfast they've served up
for doing locking, it may not be ksh's fault).

Also, is there any way to switch between different history files *within* a
shell?  My motivation - to use /dev/null for a while so sourced-in function
definitions don't clutter up the real one.

-- 
Jack Campin  *  Computing Science Department, Glasgow University, 17 Lilybank
Gardens, Glasgow G12 8QQ, SCOTLAND.    041 339 8855 x6045 wk  041 556 1878 ho
INTERNET: jack%cs.glasgow.ac.uk@nss.cs.ucl.ac.uk    USENET: jack@glasgow.uucp
JANET: jack@uk.ac.glasgow.cs     PLINGnet: ...mcvax!ukc!cs.glasgow.ac.uk!jack

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (02/15/89)

In article <2401@crete.cs.glasgow.ac.uk> jack@cs.glasgow.ac.uk (Jack Campin) writes:
| Does anyone know what protocol ksh uses for sharing the history file when
| running multiple sessions?  I cannot make sense of what I see happening.  Does
| it act differently for shells run from distinct NFS clients than when all
| shells are on the same machine?  Is there any concurrency control at all?

  If you want to have separate history files for each session (I usually
run 3-5 connections on Xenix virtual terminals) you can do so by setting
the name of the HISTFILE variable. You can use something as simple as
the PID, or something a bit more informative, such as
	HISTFILE="/tmp/hist.$(basename $(tty))"
The advantage of this (at least with virtual terminals) is that you keep
the same history file for each terminal.

  Please note that you have to set HISTFILE *before* setting the editing
option, like "set -o emacs" or vi.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me