redhat5之初始化指令碼檔案呼叫次序.bash_profile_.bashrc_bashrc

wisdomone1發表於2013-06-05

---root家目錄

[root@rhel5 ~]# pwd
/root

----檢視所有檔案
[root@rhel5 ~]# ls -la
total 128
drwxr-x---  2 root root  4096 Jun  4 04:08 .
drwxr-xr-x 28 root root  4096 Jun  5 02:24 ..
-rw-------  1 root root  1041 Jun  3 08:46 anaconda-ks.cfg
-rw-------  1 root root  3443 Jun  4 08:54 .bash_history
-rw-r--r--  1 root root    24 Jul 13  2006 .bash_logout
-rw-r--r--  1 root root   191 Jul 13  2006 .bash_profile
-rw-r--r--  1 root root   176 Jul 13  2006 .bashrc
-rw-r--r--  1 root root     0 Jun  4 04:08 c1
-rw-r--r--  1 root root     0 Jun  4 04:08 c2
-rw-r--r--  1 root root   100 Jul 13  2006 .cshrc
-rw-r--r--  1 root root 29623 Jun  3 08:46 install.log
-rw-r--r--  1 root root     0 Jun  3 08:37 install.log.syslog
-rw-------  1 root root    35 Jun  5 02:07 .lesshst
-rw-r--r--  1 root root   129 Jul 13  2006 .tcshrc

--.bash_profile會呼叫.bashrc
[root@rhel5 ~]# more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

---.bashrc會呼叫/etc/bashrc
[root@rhel5 ~]# more .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
[root@rhel5 ~]#

小結:1,如果你要在重啟或啟動執行一些任務,可以直接在.bash_profile新增對應的指令碼即可

2,/etc/bashrc最好不要改.除非你明白裡面的含義

3,家目錄有檔案:.bashrc和.bash_profile,而/etc目錄有bashrc

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-763029/,如需轉載,請註明出處,否則將追究法律責任。

相關文章