验证bash的配置文件加载顺序
2013-07-18 18:54
295 查看
系统版本:Red Hat Enterprise Linux Server release 6.2 (Santiago)
实验准备:
--------------[root@db1 ~]# for file in /etc/profile /etc/profile.d/a.sh ~/.bash_profile ~/.bashrc /etc/bashrc;do touch $file;mv $file $file.bak ;echo ' echo '$file' load start @ `date +%S.%N`' >> $file; cat $file.bak >>$file;echo ' echo '$file' load finished @ `date +%S.%N`' >> $file;done--------------
结果:
login shell:
[root@db1 ~]# su - root/etc/profile load start @ 00.342533947/etc/profile.d/a.sh load start @ 00.375653156/etc/profile.d/a.sh load finished @ 00.386663719/etc/profile load finished @ 00.459338038/root/.bash_profile load start @ 00.472126516/root/.bashrc load start @ 00.501099137/etc/bashrc load start @ 00.517663430/etc/bashrc load finished @ 00.530761110/root/.bashrc load finished @ 00.548283973/root/.bash_profile load finished @ 00.567944143
非login shell:
[root@db1 ~]# su root
/root/.bashrc load start @ 22.772783963/etc/bashrc load start @ 22.785428207/etc/profile.d/a.sh load start @ 22.801624494/etc/profile.d/a.sh load finished @ 22.816499465/etc/bashrc load finished @ 22.881630850/root/.bashrc load finished @ 22.892364478
图示:(时间重叠部分体现了相互调用关系)
实验准备:
--------------[root@db1 ~]# for file in /etc/profile /etc/profile.d/a.sh ~/.bash_profile ~/.bashrc /etc/bashrc;do touch $file;mv $file $file.bak ;echo ' echo '$file' load start @ `date +%S.%N`' >> $file; cat $file.bak >>$file;echo ' echo '$file' load finished @ `date +%S.%N`' >> $file;done--------------
结果:
login shell:
[root@db1 ~]# su - root/etc/profile load start @ 00.342533947/etc/profile.d/a.sh load start @ 00.375653156/etc/profile.d/a.sh load finished @ 00.386663719/etc/profile load finished @ 00.459338038/root/.bash_profile load start @ 00.472126516/root/.bashrc load start @ 00.501099137/etc/bashrc load start @ 00.517663430/etc/bashrc load finished @ 00.530761110/root/.bashrc load finished @ 00.548283973/root/.bash_profile load finished @ 00.567944143
非login shell:
[root@db1 ~]# su root
/root/.bashrc load start @ 22.772783963/etc/bashrc load start @ 22.785428207/etc/profile.d/a.sh load start @ 22.801624494/etc/profile.d/a.sh load finished @ 22.816499465/etc/bashrc load finished @ 22.881630850/root/.bashrc load finished @ 22.892364478
图示:(时间重叠部分体现了相互调用关系)
相关文章推荐
- MAC下bash配置文件的加载顺序
- Linux下文件 ~/.bashrc 和 ~/.bash_profile 和 /etc/bashrc 和 /etc/profile 的区别 | 用户登录后加载配置文件的顺序
- bash配置文件加载顺序
- bash的配置文件以及加载的顺序
- Linux 配置文件 启动文件rc.local、/etc/bash.bashrc、~/bashrc、/etc/profile、~/.profile加载顺序
- MAC下bash配置文件的加载顺序
- bash配置文件加载顺序
- Linux下文件 ~/.bashrc 和 ~/.bash_profile 和 /etc/bashrc 和 /etc/profile 的区别 | 用户登录后加载配置文件的顺序
- bash 的配置文件加载顺序
- 关于JSP配置文件web.xml加载顺序详解
- vim 配置文件加载顺序笔记
- Struts2配置文件加载顺序
- 关于linux下my.ini配置文件的加载顺序
- struts2中配置文件的加载顺序
- linux下系统启动时,几个配置文件 /etc/profile、~/.bash_profile 等几个文件的执行过程,先后顺序
- Struts2的学习之路(四)配置文件加载顺序
- web.xml配置文件的加载顺序
- web.xml文件中配置( listenr, filter,servlet, spring)的加载顺序 研究(转)
- struts2:struts.properties配置文件介绍及常量加载顺序
- Struts2加载配置文件时的顺序