Because I'm using multiple xterms running bash I would like to share the command history between all bashes instantly. Meaning that if I enter a command in xterm-1 and change to xterm-2 afterwards I would like to see the same command in the history of that bash. I know that each bash procces maintains it's own history list synchronising it to history file only at session end and invocation of a new session but not at run time. I also know that I could force each bash updateing and rereading the history file by calling history -a; history -n every time but this is cumbersome an unpractical. How can I achieve that?
edisp: Here are some hints that might help you with your problem:
1. You need to have histappend set in your bash environment to ensure that the histories from the different terms will not overwrite themselves. In case you don't have this set already you can put it somewhere in your bashrc: shopt -s histappend 2. To my knowledge there is no parameter in bash to achieve what you are looking for (that sounds very reasonable btw, and should be like that by default imo). So you can try a trick in order to not have to type history -a; history -n all the time manually. You can try to put this in your PROMPT_COMMAND and append it to your existing one, like: PROMPT_COMMAND=’history -a; history -n’ Let me know if this worked for you.
guest: sorry I have no idea. Without seeing this I can't help you on this issue as it never happened to me, and I have on idea why it would happen. Maybe someone else might help you if they have seen the same problem in the past.