2013-02-16 18 views
7

शैल शुरू होने पर मुझे .bashrc फ़ाइल लोड होने पर कैसे पता चलेगा? क्या कोई आदेश है जो मुझे बता सकता है?उबंटू bashrc फ़ाइल कैसे फ़ाइल का उपयोग करने के लिए फ़ाइल को खोजने के लिए?

वर्तमान में मुझे लगता है कि यह /root/.bashrc है यह एक उबंटू सर्वर 10.04 एलटीएस है।

क्या यह उपयोगकर्ता आधारित है या?

उत्तर

9

आदेश आप की तलाश man bash है, जो आपको बताता है:

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. 

और

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

here से यह प्रतीत होता है कि आपका ~/.bashrc तब तक चल रहा है जब तक आप रूट के रूप में लॉग इन नहीं कर रहे हैं, /root/ रूट का घर है।

+0

ठीक है, यदि ऐसा है तो मैं "के रूप में someuser" में लॉग इन कर रहा हूँ यह/घर में .bashrc उपयोग कर रहा है /someuser/.bashrc .bashrc_profile के बारे में क्या? –

2

बस गूंज का उपयोग करें। bashrc

echo "I am in $PWD/$0" or "I am in bashrc file". 
है कि आप जब जो आप की पुष्टि करेगा कि प्रक्रिया विशिष्ट स्क्रिप्ट फ़ाइल का उपयोग करता है एक मुद्रित संदेश पर लॉग ऑन देखेंगे के साथ

में एक अभिव्यक्ति रखो। नोट - उदाहरण के लिए यह बुद्धिमान नहीं है bashrc या bash_profile से एक प्रोग्राम शुरू करें, क्योंकि यदि किसी कारण से प्रोग्राम शुरू नहीं होगा या शुरू करने में परेशानी होगी, तो आपको एक खोल में नहीं मिलेगा।

+1

यदि वे मौजूद हैं तो शैल के स्टार्टअप पर आमतौर पर विभिन्न फ़ाइलों का उपयोग किया जाता है। आप कहां अपना कथन डालते हैं, आप यह पता लगा सकते हैं कि/etc/bashrc का उपयोग किया जाता है,/etc/bash/rcfile,/etc/profile, /etc/bash_completion.d/ कुछ अन्य फ़ाइल, ~/.bashrc, ~ /profile , ~/.bash_profile इत्यादि। "रूट" उपयोगकर्ता आमतौर पर ~/.profile है जबकि आम उपयोगकर्ता ~/.bash_profile –

संबंधित मुद्दे