Skip to content

Instantly share code, notes, and snippets.

@javaJake
Last active November 21, 2020 18:54
Show Gist options
  • Save javaJake/cd473be7a019618f4bdd to your computer and use it in GitHub Desktop.
Save javaJake/cd473be7a019618f4bdd to your computer and use it in GitHub Desktop.
Use the prompt to synchronize history between shells
shopt -s histappend
HISTTIMEFORMAT="%s "
ETERNAL_HISTORY_FILE="$HOME/.bash_eternal_history"
PROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"
PROMPT_COMMAND='echo "$$" "$USER" "$(history 1)" >> "$(eval '"'"'echo $ETERNAL_HISTORY_FILE'"'"')"; '"${PROMPT_COMMAND}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment