-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path050-history.sh
22 lines (19 loc) · 954 Bytes
/
050-history.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
##################################################################################################
# History settings
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
# NOTE: these settings can have undesirable effects with older bash versions.
##################################################################################################
HISTSIZE=-1
# Save all history
HISTFILESIZE=-1
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S: "
# Append (not overwrite) to the HISTFILE on session exit.
shopt -s histappend
# Doesn't matter when using FZF, but useful for vanilla readline
shopt -s histreedit
shopt -s histverify
# After each command, append, clear, and reload history.
# This allows sharing history between concurrent sessions.
# https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r;"