diff --git a/tmux/tmux/bash_history.sh b/tmux/tmux/bash_history.sh index f927cd0..a08c568 100644 --- a/tmux/tmux/bash_history.sh +++ b/tmux/tmux/bash_history.sh @@ -8,4 +8,7 @@ HISTTIMEFORMAT="%F %T " shopt -s histappend # After each command: flush to file, reload from file (syncs across all panes/windows) -PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }history -a; history -c; history -r" +# Guard against double-sourcing (e.g. multiple tmux panes all source ~/.bashrc) +if [[ "$PROMPT_COMMAND" != *"history -a; history -c; history -r"* ]]; then + PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND%;};} history -a; history -c; history -r" +fi