2025-08-18 Line 訂單系統- source ~/.bash_profile 這是什麼意思?

2025-08-18 Line 訂單系統- source ~/.bash_profile 這是什麼意思?

這一步其實是 Linux / macOS 裡的基礎概念,我用最簡單的方式解釋給你:


source ~/.bash_profile 的意思是:重新載入 Bash 設定

你剛剛把 nvm 的設定寫進:

1
~/.bash_profile

這是 Bash 的「設定檔」,只有 在你登入 / 開新終端機 的時候才會被讀取。

但是:

  • 你已經打開 Terminal
  • 你不想重新開啟或登出登入

這時就需要輸入:

1
source ~/.bash_profile

✔ 把剛剛修改的設定 → 即時生效

✔ 不用重開終端

✔ 不用重開機


📌 用生活比喻:

就像你修改了手機 App 的設定(例如:打開推播),
但 App 還沒更新設定。

你按一下 “重載” 鈕 → 就立即生效。

source ~/.bash_profile 就是按這個「重載設定鈕」。


📌 語法原理

source = 執行一個檔案裡的所有命令
~/.bash_profile = 你的個人 Bash 設定檔

所以就是:

1
執行 ~/.bash_profile 裡面的所有設定

⭐ 用途

當你修改:

  • PATH
  • nvm
  • conda
  • node
  • git
  • python
  • ruby
  • sdkman

等設定時,都需要用 source 重新載入。


👉 現在你只要做這件事:

1
source ~/.bash_profile

然後測試:

1
nvm --version

貼給我,我幫你確認 nvm 是否成功啟動!