Separate history between instances (2019-10-03 17:22 by ninewise #83656)
Is there a way to separate history between instances?
I'm really used to executing the previous command (in the current shell) with up+enter, but yash inserts commands from other instances here.
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?
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:
HISTFILE=
HISTSIZE=5000
HISTRMDUP=5000
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.