linux bash & profile &bash_profile 小结

 

 

login 方式:: su - oracle
依次 /etc/bash.bashrc———— /home/$user/.bashrc ———— /ect/profile ———— /home/$user/.bash_profile(找不到~/.bash_profile, 则寻找~/.bash_login,若前两者不存在,读取~/.profile) -- 可见.profile的作用其实很次要的
正常

bash.bashrc
oracle .bashrc
etc profie
oracle .bash_profile


/home/oracle # mv .bashrc .bashrc2
bash.bashrc
etc profie!!
oracle .bash_profile


linux:/home/oracle # mv .bash_profile .bash_profile2
linux:/home/oracle # ..
linux:/home # su - oracle
bash.bashrc
etc profie!!
oracle . proflie


非login方式:————————图形界面? 等等。。 依次 /etc/bash.bashrc———— /home/$user/.bashrc
linux:/home/oracle # su oracle
bash.bashrc
oracle .bashrc

 

1. 图形模式登录时,顺序读取:/etc/profile和~/.profile ----(3)~/.profile ---- 图形模式登录时,此文件将被读取,即使存在~/.bash_profile和~/.bash_login

2. 图形模式登录后,打开终端时,顺序读取:/etc/bash.bashrc和~/.bashrc

3. 文本模式登录时,顺序读取:/etc/bash.bashrc,/etc/profile和~/.bash_profile ---- 貌似这里第二步少了个~/.bashrc


(5)和(6) 有些矛盾。。

后面的内容就太啰嗦了! 而且有些不对。不应该看。


Xshell:\> open 218
Connecting to 10.67.164.218:22...
Connection established.
Escape character is '^@]'.

Last login: Fri Apr 25 17:31:32 2014 from 10.74.169.50

etc bash.bashrc
.bash rc
etc profie!!
root . bash_profile (root 的根目录下没有.bash_profile 则新建一个)

可见这个顺序和su - root的顺序一样的

 

 

 


/etc/bash.bashrc 有的系统没有此文件,而对应的是 bashrc
/etc/profile


/export/home/$user ??
/home/$user/

.bashrc
.proflie
.bash_history ?

.inputrc ?

http://www.cnblogs.com/yangwindsor/articles/3380322.html
bashrc用于交互式non-loginshell,而profile用于交互式login shell

 

 

关于 bash & profile

其实明白了一点就很容易理解、记忆了,否则下次可能还是忘记::

bash  是shell 脚本, 执行shell 是不一定要登录的, 所以,他隐隐约约表示non-login

profile 是概括文件, 包含一些环境变量等等预处理变量、脚本、函数,  所以每次login 的时候都要执行一下

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值