V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Livid
267.12D
573.31D
V2EX  ›  macOS

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

  •  
  •   Livid ·
    PRO
    · Jun 20, 2012 · 4151 views
    This topic created in 5061 days ago, the information mentioned may be changed or developed.
    1 replies    1970-01-01 08:00:00 +08:00
    skyahead
        1
    skyahead  
       Jun 20, 2012
    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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   999 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:13 · PVG 04:13 · LAX 13:13 · JFK 16:13
    ♥ Do have faith in what you're doing.