2013-02-16 15 views

risposta

9

Il comando che cercate è man bash, che ti dice:

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. 

e

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

Da here sembrerebbe che il tuo ~/.bashrc venga eseguito a meno che tu non stia effettuando il login come utente root, come /root/ è root home.

+0

Ok, quindi se sono entrato come "someuser" sta utilizzando il .bashrc in/home /someuser/.bashrc e il .bashrc_profile? –

2

Basta usare echo. Mettere un'espressione in bashrc

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

Con che si vedrà quando si accede un messaggio stampato che confermerà che processo utilizza file di script specifici. Nota: non è saggio ad es. avvia un programma da bashrc o bash_profile, perché se il programma per qualche motivo non si avvia o avrà problemi ad iniziare, non entrerai in una shell.

+1

In genere, all'avvio della shell vengono utilizzati vari file, se presenti. a seconda di dove hai inserito la tua affermazione, potresti scoprire che/etc/bashrc è usato,/etc/bash/rcfile,/etc/profile, /etc/bash_completion.d/questo file, ~/.bashrc, ~/.profile , ~/.bash_profile ecc. L'utente "root" di solito ha ~/.profile mentre l'utente comune ~/.bash_profile –

Problemi correlati