zoukankan      html  css  js  c++  java
  • 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 的时候都要执行一下

  • 相关阅读:
    Linq to sql与EF零碎知识点总结
    个人总结js客户端验证
    asp.net、mvc、ajax、js、jquery、sql、EF、linq、netadvantage第三方控件知识点笔记
    c#、sql、asp.net、js、ajax、jquery大学知识点笔记
    ActiveMQ 事务和XA
    三次握手“释放”连接
    ActiveMQ 集群和主从
    ActiveMQ 配置jdbc主从
    ActiveMQ 的连接和会话
    ActiveMQ 处理不同类型的消息
  • 原文地址:https://www.cnblogs.com/FlyAway2013/p/3689397.html
Copyright © 2011-2022 走看看