ge...@cs.hmc.edu wrote:
Locking should be used when truncating and writing the history file. (Yes, I know it's a pain in a portable program like bash.) Strictly speaking, locking is only half a solution, because the net result will be that the saved history is taken from a randomly chosen one of the multiple exiting shells. But that's better than the current situation where all history is lost. What might be cooler would be to merge all the history lines from all shells, in timestamp order. But given the current history file format, that seems...hard.
---- You shouldn't write to the same history file from multiple sessions. Encode the session name (or ttyname) in the history file name Then they won't collide as you can only have 1 person logged in / tty.