Bläddra i källkod

Option to preserve bash history

tags/2016.12
Filip Pytloun 8 år sedan
förälder
incheckning
eef11c1aa0
4 ändrade filer med 39 tillägg och 0 borttagningar
  1. +13
    -0
      README.rst
  2. +12
    -0
      linux/files/bash_history.sh
  3. +11
    -0
      linux/system/bash.sls
  4. +3
    -0
      linux/system/init.sls

+ 13
- 0
README.rst Visa fil

``/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
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~



+ 12
- 0
linux/files/bash_history.sh Visa fil

{%- 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

+ 11
- 0
linux/system/bash.sls Visa fil

{%- 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 %}

+ 3
- 0
linux/system/init.sls Visa fil

{%- 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 %}

Laddar…
Avbryt
Spara