在进入linux时候,系统读取的环境变量是/etc/profile中的还是~/.bash_profile中的?

来源:百度知道 编辑:UC知道 时间:2024/05/04 03:40:16
读取/etc/profile中的环境变脸是只在登陆时读取一次还是每次都读取??
如果是每次都是读取/etc/profile那么~/.bash_profile和~/.bashrc用来感什么??

/etc/profile用于整个系统所有用户, ~/.bash_profile, ~/.profile和~/.bashrc 用于各个用户,这里的"~"符号就是各当前用户的$HOME
~/.bash_profile 和 ~/.profile 只在登陆时读取一次。
~/.bashrc 每次都读取

~/.bash_profile 和 ~/.profile 的区别在于,bash 只读取~/.bash_profile;而对于 ~/.profile 来说,不光bash, 其他shell 也读 ~/.profile

成拗口令了!其实我写这么多,你分那么清都没多大意义。