Livid
277.21D
571.09D
V2EX  ›  macOS

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

  •  
  •   Livid ·
    PRO
    · Jun 20, 2012 · 4192 views
    This topic created in 5078 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   ·   2986 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:45 · PVG 22:45 · LAX 07:45 · JFK 10:45
    ♥ Do have faith in what you're doing.