Monday, July 7, 2014
bash - history sharing between sessions
# .bash_rc
HISTSIZE=9000
HISTFILESIZE=$HISTSIZE
HISTCONTROL=ignorespace:ignoredups
history() {
_bash_history_sync
builtin history "$@"
}
_bash_history_sync() {
builtin history -a #1
HISTFILESIZE=$HISTSIZE #2
builtin history -c #3
builtin history -r #4
}
PROMPT_COMMAND=_bash_history_sync
history() overrides the original function to make sure that the history is synchronised before it is printed, so the numbers match.
Source | cheat sheet (pdf) | Nice article
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment