bashrc,bash_profile和/etc/profile
bashrc,bash_profile和/etc/profile
最近老出現在shell里面能跑的程序用鼠標雙擊app去不能跑.究其原因是因為環境變量的問題.
在類unix系統中一般有三個bash配置文件:
- ~/.bashrc 當前用戶使用的配置文件
- ~/.bash_profile 當前用戶使用的配置文件
- /etc/profile 所有用戶都會繼承的環境配置文件
我們需要搞清楚/etc/profile, ~/.bash_profile和~/.bashrc這幾個文件的加載順序.
一般來說~/.bash_profile > ~/.bash_rc > /etc/profile, 也就是說當沒有找到bash_profile則使用bashrc再沒找到就用/etc/profile
有興趣的可以參考這篇博文:?http://blog.galeo.me/post/23467503436/path-environment-variable-on-mac-os-x-emacs-app
?
在MacOSX的shell中讀取的是.bash_profile,而不讀取.bashrc.有兩個配置也挺讓人頭痛的,不過stackoverflow給出了解決方案
Terminal opens a login shell. This means, ~/.bash_profile will get executed, ~/.bashrc not. The solution on most systems is to ?require“ the ~/.bashrc in the ~/.bash_profile: just put this snippet in your ~/.bash_profile:
[[ -s ~/.bashrc ]] && source ~/.bashrc轉載于:https://www.cnblogs.com/clivelee/p/3870510.html
總結
以上是生活随笔為你收集整理的bashrc,bash_profile和/etc/profile的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 浅谈微信小程序对于房地产行业的影响
- 下一篇: eclipse配置java环境_java