Re: Separate history between instances (2019-10-16 21:17 by ninewise #83704)
Reply To Message #83656
> I'm thinking I could set a different HISTFILE per instance (with mktemp) in the RC, and trap some sort of `history merge` on exit. Maybe someone already wrote this merge?
I've solved this by merging in a "stupid" way: in my RC I have:
history -r .yash_history
trap 'h=$(mktemp) && history -w $h && history -c && history -r .yash_history && history -r $h && history -w .yash_history && rm $h' EXIT
This will "merge" the history on closing the shell. This does result in having a simplified history file, not the default fanciness - but for now this hasn't troubled me. Should someone have a "smart" merge, I'd still be interested, though.