来自$ man bash
:
当bash作为交互式登录shell或作为具有--login选项的非交互式shell调用时,它首先从文件/ etc/profile中读取并执行命令(如果该文件存在).在读取该文件之后,它按顺序查找〜/ .bash_profile,〜/ .bash_login和〜/ .profile,并从存在且可读的第一个命令中读取并执行命令.
和
当启动不是登录shell的交互式shell时,如果该文件存在,bash将从〜/ .bashrc读取并执行命令.
所以:
shell | files loaded
--------+-----------------
bash -l | /etc/profile
| ~/.bash_profile
| ~/.bash_login
| ~/.profile
--------+-----------------
bash -i | ~/.bashrc
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1439 次 |
最近记录: |