``/etc/skel/.bashrc``). This formula will do this automatically, but will not | ``/etc/skel/.bashrc``). This formula will do this automatically, but will not | ||||
touch existing user's ``~/.bashrc`` files except root. | touch existing user's ``~/.bashrc`` files except root. | ||||
Bash | |||||
~~~~ | |||||
Fix bash configuration to preserve history across sessions (like ZSH does by | |||||
default). | |||||
.. code-block:: yaml | |||||
linux: | |||||
system: | |||||
bash: | |||||
preserve_history: true | |||||
Message of the day | Message of the day | ||||
~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~ | ||||
{%- from "linux/map.jinja" import system with context %} | |||||
# History across sessions for Bash | |||||
if [ -n "$BASH_VERSION" ]; then | |||||
# Avoid duplicates | |||||
export HISTCONTROL=ignoredups:erasedups | |||||
# When the shell exits, append to the history file instead of overwriting it | |||||
shopt -s histappend | |||||
# After each command, append to the history file and reread it | |||||
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r" | |||||
fi |
{%- from "linux/map.jinja" import system with context %} | |||||
{%- if system.enabled %} | |||||
{%- if system.bash.get('preserve_history', False) %} | |||||
/etc/profile.d/bash_history.sh: | |||||
file.managed: | |||||
- source: salt://linux/files/bash_history.sh | |||||
- template: jinja | |||||
{%- endif %} | |||||
{%- endif %} |
{%- if system.prompt is defined %} | {%- if system.prompt is defined %} | ||||
- linux.system.prompt | - linux.system.prompt | ||||
{%- endif %} | {%- endif %} | ||||
{%- if system.bash is defined %} | |||||
- linux.system.bash | |||||
{%- endif %} | |||||
{%- if system.user|length > 0 %} | {%- if system.user|length > 0 %} | ||||
- linux.system.user | - linux.system.user | ||||
{%- endif %} | {%- endif %} |