If you provide file names for the options HistFile and DirHistFile TCC reads them at the beginning of a session, maintains changes during the session and rewrites the files on exit. Now, if a secondary shell is started it too will read the original history lists and add its own new records to them. When these shells exit they will both write to the same files and the last to write will obliterate the recent history written by the first shell to exit.
This description is not entirely complete. I have noticed that, if the secondary shell exits first, the command history of the primary shell is immediately screwed up. I guess it detects the update at some point and rereads the histories, removing all its history between startup and the moment the secondary shell was launched. This must mean that the secondary shell does not inherit the primary shell's in-memory lists, it just reads the files. Life would be beautiful if the shell that launches a secondary shell would first do an intermediate save.
Question: how to fix this. Can I write two different files and merge them later somehow? Ideas anyone?
This description is not entirely complete. I have noticed that, if the secondary shell exits first, the command history of the primary shell is immediately screwed up. I guess it detects the update at some point and rereads the histories, removing all its history between startup and the moment the secondary shell was launched. This must mean that the secondary shell does not inherit the primary shell's in-memory lists, it just reads the files. Life would be beautiful if the shell that launches a secondary shell would first do an intermediate save.
Question: how to fix this. Can I write two different files and merge them later somehow? Ideas anyone?