[英]What's the difference between Git bash and WSL
我剛剛在我的 Windows 機器上安裝了 Git SCM。 我的機器之前安裝了 Node。 我可以在 git bash 中使用 node -v。 但是,為什么我能夠在 Git Bash 中使用 windows 應用程序而不是在 WSL Z7024FF03F70DEC6DAB1779A 中。
WSL Bash 內部
hello@comp:~$ node -v
Command 'node' not found, but can be installed with:
sudo apt install nodejs
內部 Git Bash-
hello@comp MINGW64
$ node -v
v12.10.0
WSL 是一個類似於 Linux 的兼容層。 You run Linux applications on top of WSL and they think they are running natively on Linux while the system calls are being translated to Windows OS system calls (WSL2 -- not yet released -- is a full Linux kernel running inside Windows). 您確實可以通過 /mnt/c/... 訪問 Windows 文件,但就 Windows-Linux 互操作性而言,這就是您所能期望的。
另一方面,Git-bash 是一個Windows應用程序——一個運行 windows 應用程序的 shell。 其中一些可以使用 Linux 兼容庫(Cygwin) 編譯。 但他們不必如此。 這提供了一種不太“類似 Linux”的體驗,但如果您只需要一些 Linux 命令行工具並且不需要安裝成熟的 Linux 可執行文件,這可能是一個很好的折衷方案。
兩種“環境”的 PATH 定義是不同的。 檢查節點的目錄是否顯示在 Git bash 上,而不是 WSL Bash 中。 在兩個環境中運行它:
echo $PATH
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.