linux終端出現bash: setup.bash: No such file or directory,和.bashrc檔案的問題__linux

來源:互聯網
上載者:User

前段時間linux中開啟終端時,總是出現bash: /opt/ros/indig/setup.bash: No such file or directory的問題。此問題跟每次終端開啟時要載入的bash有關,於是查bash的相關文檔知道了:

/etc/profile:此檔案為系統的每個使用者佈建環境資訊,當使用者第一次登入時,該檔案被執行,並從/etc/profile.d目錄的設定檔中搜集shell的設定.
/etc/bashrc:為每一個運行bash shell的使用者執行此檔案.當bash shell被開啟時,該檔案被讀取.
~/.bash_profile:每個使用者都可使用該檔案輸入專用於自己使用的shell資訊,當使用者登入時,該檔案僅僅執行一次!預設情況下,他設定一些環境變數,執行使用者的.bashrc檔案.
~/.bashrc:該檔案包含專用於你的bash shell的bash資訊,當登入時以及每次開啟新的shell時,該檔案被讀取.
~/.bash_logout:當每次退出系統(退出bash shell)時,執行該檔案. 

我挨個地開啟這些檔案,最後在~/.bashrc這個檔案的最後一行發現了:source /opt/ros/indig/setup.bash  而這個bash檔案在檔案系統中是不存在的,於是我把它刪掉。之後再啟動終端時就正常了。

另:我們可以通過

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
命令來把某個路徑加入.bashrc檔案。

然後通過

source ~/.bashrc
命令來把使其生效。




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.