Last active
October 8, 2025 00:26
-
-
Save daryltucker/df70e8e33489b00dba51493dfa52a6e7 to your computer and use it in GitHub Desktop.
Ensure tmux is storing history properly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ensure tmux is storing history properly | |
| HISTFILE=~/.bash_history | |
| export HISTCONTROL=ignoredups:erasedups,ignoreboth | |
| if [ -n "$TMUX" ]; then | |
| HISTFILE=$(mktemp) | |
| history -r ~/.bash_history | |
| trap 'history -a ~/.bash_history; rm "$HISTFILE"' EXIT | |
| else | |
| trap 'history -a ~/.bash_history' EXIT | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment