Warum wird ~/.bash_profile nicht gelesen?
Erik Zettel
lists06 at freenet.de
Son Jul 2 06:44:50 BST 2006
On Sat, 01 Jul 2006 23:46:36 +0200
Alexander Skwar <listen at alexander.skwar.name> wrote:
> In meiner ~/.bash_profile habe ich u.a. stehen:
> PATH=$PATH:$HOME/bin:/usr/sbin:/sbin:$HOME/server/bin
> export PATH
> [...]
Moin, Moin!
Ist die gute alte bash, ash oder ksh die *Login-Shell* des jeweiligen
Benutzers des Systems[1], so wertet diese die Dateien /etc/profile und
$HOME/.profile bzw. $HOME/.bash_profile aus[2]. Hierbei ist zu beachten,
dass global definierte Shellvariablen durch die "lokalen" Variablen
überschrieben werden (können).
/etc/bash.bashrc sowie $HOME/.bashrc werden durchaus nur von
*interaktiven* *Nicht-Login-Shells*[3] ausgewertet.
Aber: [4] in den jeweiligen profile-Dateien führt dazu, dass die
"Einstellungen" für *Nicht-Login-Shells* in den *Login-Shells*
übernommen werden.
MfG
Erik
[1]:
$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
[...]
[2]:
$ cat ~/.bash_profile
# ~/.bash_profile: executed by bash(1) for login shells.
[...]
[3]:
$ cat ~/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
[...]
[4]:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
bzw.
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi