2013-02-16 17 views

Antwort

9

Der Befehl, den Sie suchen, ist man bash, die Ihnen sagt:

When bash is invoked as an interactive login shell, or as a non-inter- 
    active shell with the --login option, it first reads and executes com- 
    mands from the file /etc/profile, if that file exists. After reading 
    that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, 
    in that order, and reads and executes commands from the first one that 
    exists and is readable. The --noprofile option may be used when the 
    shell is started to inhibit this behavior. 

und

When an interactive shell that is not a login shell is started, bash 
    reads and executes commands from ~/.bashrc, if that file exists. This 
    may be inhibited by using the --norc option. The --rcfile file option 
    will force bash to read and execute commands from file instead of 
    ~/.bashrc. 
2

Von here scheint es, dass Ihre ~/.bashrc ausgeführt wird, es sei denn, Sie melden sich als root, wie /root/ ist Root-Startseite.

+0

Ok, also wenn ich als "someuser" angemeldet ist es die Bashrc in/home mit /someuser/.bashrc Was ist mit dem .bashrc_profil? –

2

Verwenden Sie einfach echo. Setzen Sie einen Ausdruck in bashrc

echo "I am in $PWD/$0" or "I am in bashrc file". 

Damit Sie sehen, wenn auf einer gedruckten Nachricht protokolliert, die Sie bestätigen, dass Verfahren verwendet bestimmte Skriptdatei. Hinweis - es ist nicht ratsam, z.B. starte ein Programm von bashrc oder bash_profile, denn wenn das Programm aus irgendeinem Grund nicht startet oder Probleme beim Starten hat, wirst du nicht in eine Shell gelangen.

+1

Normalerweise werden verschiedene Dateien beim Start der Shell verwendet, wenn sie existieren. Je nachdem, wo Sie Ihre Anweisung ablegen, können Sie herausfinden, dass/etc/bashrc verwendet wird,/etc/bash/rcfile,/etc/profile, /etc/bash_completion.d/eine andere Datei, ~/.bashrc, ~/.profile , ~/.bash_profile usw. Der Benutzer "root" hat normalerweise ~/.profile, während der allgemeine Benutzer ~/.bash_profile –