User Tools

Site Tools


linux:shell:bash

This is an old revision of the document!


Bash Reihenfolge der Konfigurations-Files

+----------------+-----------+-----------+------+
|                |Interactive|Interactive|Script|
|                |login      |non-login  |      |
+----------------+-----------+-----------+------+
|/etc/profile    |   A       |           |      |
+----------------+-----------+-----------+------+
|/etc/bash.bashrc|           |    A      |      |
+----------------+-----------+-----------+------+
|~/.bashrc       |           |    B      |      |
+----------------+-----------+-----------+------+
|~/.bash_profile |   B1      |           |      |
+----------------+-----------+-----------+------+
|~/.bash_login   |   B2      |           |      |
+----------------+-----------+-----------+------+
|~/.profile      |   B3      |           |      |
+----------------+-----------+-----------+------+
|BASH_ENV        |           |           |  A   |
+----------------+-----------+-----------+------+
|                |           |           |      |
+----------------+-----------+-----------+------+
|~/.bash_logout  |    C      |           |      |
+----------------+-----------+-----------+------+

Es wird der Reihe nach eingelesen A → B → C, bei B1, B2, B3 wird nur das erste Gefundene eingelesen, die Restlichen nicht mehr. https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

Check welche Shell benutzt wird

[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'

shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'

Direkt an Console anmelden und X11 starten –> non-login shell
Per ssh an melden –> login shell

linux/shell/bash.1697710162.txt.gz · Last modified: 2023/10/19 12:09 by ms

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki