Linux的环境变量可在多个文件中配置
/etc/profile,/etc/profile.d/*.sh,~/.bashrc,~/.bash_profile等
bash的运行模式可分为login shell和non-login shell。
- 例如,我们通过终端,输入用户名、密码,登录系统之后,得到就是一个login shell,而当我们执行以下命令ssh hadoop103 command,在hadoop103执行command的就是一个non-login shell。
这两种shell的主要区别在于,它们启动时会加载不同的配置文件
login shell启动时会加载/etc/profile,~/.bash_profile,~/.bashrc
non-login shell启动时会加载~/.bashrc
验证结论
1.登录式shell
在/etc/profile
2.非登陆式shell
在/etc/bashrc