User Tools

Site Tools


linux:shell:bash

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 –> interactive, non-login shell
Per ssh an melden –> interactive, login shell

linux/shell/bash.txt · Last modified: 2023/10/19 12:10 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