Bash 文件 - /etc/profile 与 ~/.bash_profile 文件

Bash 文件 - /etc/profile 与 ~/.bash_profile 文件

有人知道 /etc/profile 和 ~/.bash_profile 文件有什么区别吗?哪一个先执行?

答案1

   When bash is invoked as an interactive login shell, or as a  non-inter‐
   active  shell with the --login option, it first reads and executes com‐
   mands from the file /etc/profile, if that file exists.   After  reading
   that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
   in that order, and reads and executes commands from the first one  that
   exists  and  is  readable.  The --noprofile option may be used when the
   shell is started to inhibit this behavior.

这是逐字逐句摘自man bash。男人是你的朋友 :)

相关内容