日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

bashrc,bash_profile和/etc/profile

發布時間:2023/12/9 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。