Last active
September 25, 2020 12:53
-
-
Save dzamlo/783a701c52941fa409c1a7cfa3011f1b to your computer and use it in GitHub Desktop.
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
history_dir="${HOME}/.history/$(date +%Y/%m)" | |
mkdir -p "$history_dir" | |
HISTFILE="$history_dir/$(date --iso-8601=seconds)_${HOSTNAME}_$$" | |
export HISTSIZE="NOTHING" | |
export HISTFILESIZE="NOTHING" | |
export HISTTIMEFORMAT='%F %T ' | |
HISTCONTROL=ignoreboth | |
shopt -s histappend | |
shopt -s histverify | |
shopt -s cmdhist | |
export PROMPT_COMMAND="history -a${PROMPT_COMMAND:+;$PROMPT_COMMAND}" | |
all_hist_tmp=$(mktemp) | |
find "${HOME}/.history" -type f -printf "%T+\t%p\n" | sort | cut -f 2 | xargs cat > "$all_hist_tmp" | |
history -n "$all_hist_tmp" | |
rm "$all_hist_tmp" | |
alias nohistory="HISTFILE=/dev/null" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment