關於.bash_profile

1. 啓動終端Terminal

2. 進入當前用戶的home目錄

    輸入cd ~

3. 創建.bash_profile

    輸入touch .bash_profile

4. 編輯.bash_profile文件

    輸入open .bash_profile

  第一種方式

<1>、爲在彈出的.bash_profile文件內進行編輯  

<2>、編輯完成後直接保存文件

<3>、關閉.bash_profile文件

<4>、更新配置過的環境變量    輸入source .bash_profile

在.bash_profile文件爲鎖定狀態的時候,第一種方式是不可行的,

那麼用第二種方式來編輯.bash_profile文件

 第二種方式,在Terminal終端通過指令來對.bash_profile文件進行編輯

<1>、輸入 vim .bash_profile

<2>、輸入 i 進行編輯模式

<3>、然後把需要編輯的內容鍵入,編輯完之後直接按esc退出編輯模式,

<4>、輸入 :w 進行文件的保存        輸入 :wq 爲保存並退出指令

環境變量

export BASH_SILENCE_DEPRECATION_WARNING=1

export PATH=/usr/local/bin:$PATH

export THEOS=/opt/theos

export PATH=/opt/theos/bin/:$PATH

常規創建方式

1、創建 .bash_profile

(1) 啓動終端

(2)  cd ~  

(3)輸入touch .bash_profile

2、查看 、編輯 .bash_profile 文件

(1)終端輸入 open -e .bash_profile

  (如果只是查看,直接使用open .bash_profile)

(2)編輯

(3)關閉即可保存修改

3、更新剛配置的環境變量

輸入source .bash_profile

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章