Operating System - HP-UX
1834779 Members
2832 Online
110070 Solutions
New Discussion

Re: separate HISTFILE for each Terminal in CDE

 
SOLVED
Go to solution
Marco Mohrmann
Occasional Contributor

separate HISTFILE for each Terminal in CDE

Hello,

I want to create a separate HISTFILE for each terminal session in CDE. I think I can build a unique filename by evaluation the tty command. I have put the following lines an my .profile

TTY=`tty`
TTYNR=`basename $TTY`
HISTSIZE=1000
HF="$HOME/histfiles/$TTYNR.his"
HISTFILE=$HF
export HISTFILE HISTSIZE

but I thing this doesn't work if I open a terminal in CDE.

How can I solve this problem?

Thanks

Marco
5 REPLIES 5
Alex Glennie
Honored Contributor
Solution

Re: separate HISTFILE for each Terminal in CDE

try opening a terminal with the -ls command option eg

dtterm -ls ...... any joy ?

same will be true for hpterm ot xterm ..... -ls forces the .profile to be read.

see man dtterm etc : can also be set as a resource : loginShell : true in $HOME/.Xdefaults ..... it may help ???
Vincent Stedema
Esteemed Contributor

Re: separate HISTFILE for each Terminal in CDE

You might want to add:

if [ ! -f ${HISTFILE} ]
then
touch $HISTFILE
fi
Vincent Stedema
Esteemed Contributor

Re: separate HISTFILE for each Terminal in CDE

Also, don't forget to set DTSOURCEPROFILE to "true" in your .dtprofile

Vincent
Lyle Merdan
New Member

Re: separate HISTFILE for each Terminal in CDE

Here is what I do:

HISTFILE=$HOME/histfiles/.ksh_history.$HOSTNAME.$$

it doesn't guarantee a unique hist file but it is good enough...

Lyle Merdan
Marco Mohrmann
Occasional Contributor

Re: separate HISTFILE for each Terminal in CDE

Hi Alex,

thanks for this answer. ererything works fine

Marco