bashrc与profile的区别
bashrc用于交互式non-login shell,profile用于交互式login shell。
/etc/profile ,/etc/bashrc是系统全局环境变量设定。
/etc/profile 当用户登录系统时被读取。
/etc/bashrc 每一次运行bash shell 时去读取。
~/.profile , ~/.bashrc 是用户私有环境变量设定
当用户登入系统
1.首先读入的是全局环境变量/etc/profile,然后根据其内容读取额外的文件,如/etc/profile.d和/etc/inputrc。
2.根据不同的账号,读~/.bash_profile,如果读不了则读取~/.bash_login ,如果也读不了才读~/.profile。
3.最后读取~/.bashrc
source更新环境变量,只在该shell下有效。