Livid
288.16D
534.6D
V2EX  ›  macOS

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

  •  
  •   Livid ·
    PRO
    · Jun 20, 2012 · 4223 views
    This topic created in 5101 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   ·   5428 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 07:37 · PVG 15:37 · LAX 00:37 · JFK 03:37
    ♥ Do have faith in what you're doing.