dreistromland-common/roles/role1/files/profile.d/dreistromland-bash-history.sh
Christian Seyfferth ab0cc55c17
rename role
2024-08-27 09:47:02 +02:00

23 lines
780 B
Bash

# No bash
[ -n "${BASH_VERSION:-}" ] || exit 0
# Not an interactive session
[[ $- == *i* ]] || exit 0
# History size in Memory and File
export HISTSIZE=1000
export HISTFILESIZE=50000
# append to history instead overwriting (e.g. multiple people on the same with same user at same time)
shopt -s histappend
# ignore duplicates and the ones starting with space
export HISTCONTROL=ignoreboth
# some additional commands to ignore
export HISTIGNORE='ls:ll:ls -lah:pwd:clear:exit:history'
# History Time format
export HISTTIMEFORMAT='%F %T '
# Split multiple commands from one line to multiple history entries
shopt -s cmdhist
# Append history lines, clear and reload history, then print the prompt command
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"