bash的配置文件以及加载的顺序

来源:互联网 发布:qq mac版 编辑:程序博客网 时间:2024/05/23 01:50
站在用户登录的角度看待shell的类型:

登录式shell
1 正常登录
2 su - username
3 su -l username
非登录式shell
1 su username 
2 自动执行的shell脚本


bash配置文件:


全局配置文件

/etc/profile
/etc/profile.d/*.sh
/etc/bashrc

局部配置文件

~/.bash_profile
~/.bashrc

profile类的配置文件:

1 配置全局环境变量
2 一登录执行的命令或脚本

bash类的配置文件:

1 配置本地变量
2 定义命令别名

登录式shell加载配置文件的顺序:
/etc/profile
/etc/profile.d/*.sh
~/.bash_profile
~/.bashrc
/etc/bashrc

非登录式shell加载配置文件的顺序:

~/.bashrc
~/.bash_profile
/etc/profile.d/*.sh
0 0
原创粉丝点击