V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Livid
V2EX  ›  macOS

貌似 Mac OS X 下 sudo su root 的时候不会执行 /etc/bashrc,原因是什么呢?

  •  
  •   Livid · 2012-06-20 03:48:47 +08:00 · 3605 次点击
    这是一个创建于 4569 天前的主题,其中的信息可能已经有所发展或是发生改变。
    1 条回复    1970-01-01 08:00:00 +08:00
    skyahead
        1
    skyahead  
       2012-06-20 04:45:14 +08:00
    The main difference is that /etc/bashrc is not automatically read under any circumstance. The only way it gets included (say in ~/.bashrc), is if it's referenced in your ~/.bashrc file with something like:

    if [ -f /etc/bashrc ] ; then
    . /etc/bashrc
    fi

    /etc/profile is read automatically only if you are loginning in.


    Stole from: http://www.linuxquestions.org/questions/linux-general-1/etc-profile-v-s-etc-bashrc-273992/#post1403475
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3921 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 10:22 · PVG 18:22 · LAX 02:22 · JFK 05:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.