How to? Command history doubles each shell start

Aug 19, 2016
10
0
Hello. Long time user, 1st time posting...

I don't know if this is a bug or a configuration issue. I have had problems with the command history for a while now.

If I start a tcc shell:
[c:\]history | wc
246 614 4513

If I start another shell:
[c:\]history | wc
492 1228 9026

(All history commands are doubled)

And if I start another:
[c:\]history | wc
990 2462 18088

[c:\]history /N

[c:\]history | wc
246 614 4513

This is the case whether I launch tcc from the taskbar, use TCMD, or use Windows Terminal to launch.

I'm currently running TCC 28.02.18 x64, but I've had this issue for at least the past few versions. It is also not specific to one machine. I'm not using a tcstart or tcexit.

For the Command History Options I have
Move to end checked
Duplicates set to Save last
History set to history.txt in my tcmd directory

Global History Buffer Sized of 20480 / 8192
Local History Buffer Sized of 10000 / 4096

The contents of history.txt looks fine as far as I can tell, but with contents doubled, quadrupled, etc..
Does anyone have any ideas?
 
May 20, 2008
12,035
127
Syracuse, NY, USA
It sounds like you're doing a "HISTORY /R file", most likely in TCSTART.BTM. That will append the file to the current history. Or maybe you're doing something in TCEXIT.TSM. If you like a global history list (as I do) you might consider using SHRALIAS. You only load the history from a file once ... then start SHRALIAS. SHRALIAS.EXE keeps the global list "open", even when no TCC is running. I do this in a logon script (BTM) to load all the save lists and start SHRALIAS to guard them. SHRALIAS.EXE saves the lists when it exits (logoff, shutdown, or you terminate it with "SHRALIAS /U").

Code:
cdd %SHRALIAS_SAVE_PATH
do c in /L history dirhistory alias function ( %c /r %c.sav )
delay 1
shralias
delay 1
cdd -
 
Aug 19, 2016
10
0
Thank you Vince. I did what you suggested and it works great. I wasn't aware that shralias had the ability to save the lists on exit.
It's interesting that I wasn't using a tcstart or tcexit, but that I had set the history filespec in the TCC options.
 
May 20, 2008
12,035
127
Syracuse, NY, USA
Thank you Vince. I did what you suggested and it works great. I wasn't aware that shralias had the ability to save the lists on exit.
It's interesting that I wasn't using a tcstart or tcexit, but that I had set the history filespec in the TCC options.
Hmmm! If you weren't messing with the history in TCSTART or TCEXIT them I'm very curious about how it was being doubled.
 
Jun 2, 2008
370
4
Yeah, I'm curious too. Does echo %_tcstart or echo %_tcexit (which I can't get to work in TCC/LE :confused:) give you anything but the current state of echo?
 
Last edited:
Jan 12, 2014
502
9
Switzerland, SO
MAYBE the reason is, because you have defined it as following:

Here ...

tcc_opt_1.jpg

and here too ...

tcc_opt_2.jpg
 
Aug 19, 2016
10
0
This is what I have:

TCC 28.02.18 x64 Windows 10 [Version 10.0.19044.1889]
Copyright 2021 JP Software Inc. All Rights Reserved
Registered to GNU1

[c:\]echo %_tcstart
ECHO is OFF

[c:\]echo %_tcexit
ECHO is OFF

[c:\]option

1661398339297.png


1661398373451.png
 

Attachments

  • 1661398206713.png
    1661398206713.png
    5.5 KB · Views: 33
  • 1661398242624.png
    1661398242624.png
    6 KB · Views: 30
  • 1661398313788.png
    1661398313788.png
    35.5 KB · Views: 32
Jun 2, 2008
370
4
History set to history.txt in my tcmd directory
As in C:\Program Files\JPSoft\TCMD28, which typically isn't writable? Wherever it's at, is it writable? Does its contents ever actually change, which would also update the time and date stamp? Does it behave the same if you run TCC as admin?
 
Aug 19, 2016
10
0
It was in c:\util\tcmd\history.txt
The contents did change, not when I opened a new shell (which was when the history doubled), but when I exited a shell.
The timestamp did update.
And yes, it was the same behavior when I ran as admin

This is all academic at this point, since I have removed the entry from options and am using SHRALIAS to persist the history.
 

Similar threads