News for hackers. Stuff that matters.
Re:Keeping bash history in sync between multiple terminals by arbrandes on Monday March 26, 2012 @09:07AM (#3756441)
Great post! I use screen a lot, and always miss having the other terminal histories readily available.

However, reversing PROMPT_COMMAND so that "history -a" comes first makes more sense: this way the last command executed on the current terminal has a better chance of being on top of the list for the next up-arrow (which more closely resembles usual behavior).

Also, as noted above, it's better to append to PROMPT_COMMAND rather than just overwriting it. Thus, my .bashrc now reads:

  export PROMPT_COMMAND="history -a; history -n;${PROMPT_COMMAND}"

There are no comments on this comment yet.