[comp.unix.shell] KSH: How to set env var HISTFILE ?

luj@gus19.ecn.purdue.edu (Jun Lu) (05/11/91)

Should I set env var HISTFILE in .profile or in $ENV file ?
I think that in a wndowing environment, it's better to set HISTFILE in $ENV
file so that each window/shell has its own HISTFILE. 

What puzzels me is that I cannot find those $HISFILE(and from time to time
ksh messes up command histories in different shells). See the following:
---------- in one xterm -----------
gus3:~luj[33]$ echo $HISTFILE
/home/gus2/luj/.ksh_hist/hist754
gus3:~luj[34]$ more $HISTFILE
/home/gus2/luj/.ksh_hist/hist754: No such file or directory
-------------
----------- in anther xterm ------------
gus3:~luj[157]$ echo $HISTFILE
/home/gus2/luj/.ksh_hist/hist753
gus3:~luj[158]$ more $HISTFILE
/home/gus2/luj/.ksh_hist/hist753: No such file or directory
--------------

Can anyone tell me what goes wrong ?  I'm using ksh Version 11/16/88e on a
Sun workstation running SunOS4.x and X11 R4.

Thanks,
-- Jun
--
-- Jun Lu                          Internet:luj@ecn.purdue.edu          --
-- Aeronautics & Astronautics      Bitnet:  luj%ecn.purdue.edu@purccvm  --
-- Purdue University               UUCP:    pur-ee!luj                  -- 
-- W. Lafayette, IN 47907          Phone:317-494-9410  Fax:317-494-0307 --

rob@mtdiablo.Concord.CA.US (Rob Bernardo) (05/14/91)

luj@gus19.ecn.purdue.edu (Jun Lu) wrote:
>Should I set env var HISTFILE in .profile or in $ENV file ?
>I think that in a wndowing environment, it's better to set HISTFILE in $ENV
>file so that each window/shell has its own HISTFILE. 
>
>What puzzels me is that I cannot find those $HISFILE(and from time to time
>ksh messes up command histories in different shells). See the following:
...
>
>Can anyone tell me what goes wrong ?  I'm using ksh Version 11/16/88e on a
>Sun workstation running SunOS4.x and X11 R4.

I'm in the exact same environment and have the same motivation. I set
mine up in my $ENV file and it works just fine. Are you sure that
you are making HISTFILE an environmental variable and not just a plain ol'
shell variable? That would explain why your HISTFILE has a value but is
not used.

Btw, the lines from my env file, to be on a one-HISTFILE-per-window basiset are:

-a
HISTFILE=$HOME/.sh_hist_$(basename $(tty))
...
set +a

By naming them with the tty name, the histfiles remain between login sessions.
In one environment, where I often rlogin to other systems, I also put the
hostname in the HISTFILE value.
-- 
Rob Bernardo					Mt. Diablo Software Solutions
email: rob@mtdiablo.Concord.CA.US		phone: (415) 827-4301

rob@mtdiablo.Concord.CA.US (Rob Bernardo) (05/14/91)

I wrote:
>Btw, the lines from my env file, to be on a one-HISTFILE-per-window basis are:
>
>-a
>HISTFILE=$HOME/.sh_hist_$(basename $(tty))
>...
>set +a

That first line was supposed to be "set -a". Sorry for any confusion.
-- 
Rob Bernardo					Mt. Diablo Software Solutions
email: rob@mtdiablo.Concord.CA.US		phone: (415) 827-4301