I've seen this answer:
Preserve bash history in multiple terminal windows
This works for history, but I'm wondering if there is way to extend this so pressing "up" is shared as well?
I've seen this answer:
Preserve bash history in multiple terminal windows
This works for history, but I'm wondering if there is way to extend this so pressing "up" is shared as well?
While bash
doesn't have this exact behavior, zsh
can do this with
setopt inc_append_history share_history
It should be possible by telling bash to write out and re-read the history after each command. Untested:
PROMPT_COMMAND="$PROMPT_COMMAND"$'\nhistory -a; history -n'
Sharing the history is the default behavior of ksh. In zsh, you get this behavior by turning on the share_history
option, and you can get much finer control over how the history is saved and merged by tweaking other history options.