之前將 zsh 設為預設值,然後將其卸載,現在無法在 Visual Studio 中使用 bash

之前將 zsh 設為預設值,然後將其卸載,現在無法在 Visual Studio 中使用 bash

Terminal.integrated.shell.linux 具有「usr/bin/zsh」值。但當我卸載它時,終端沒有打開

然後我更改了一些值 對於,terminal.integrated.shell.linux,“bash” 對於,terminal.integrated.shell.osx,“bash”太 並且,terminal.external.linuxExec,“x-terminal-emulator”

現在可以了。我可以在 Visual Code Studio 中使用 bash shell

感謝大家的幫助

這是可視化程式碼截圖

答案1

看來您的編輯器配置了錯誤的路徑(或其相關終端插件),無論如何,我也會建議檢查/更新您的預設 shell 提供者。

若要檢查/更新您的 shell 提供者配置,您可以使用sudo update-alternatives --config sh列出和變更已安裝的 shell 解釋器之間的預設值(ash/dash、zsh、fish、bash...)

也可以直接設定為巴什使用sudo update-alternatives --install /bin/sh sh /bin/bash 100

然後您應該檢查編輯器的配置以及用於啟動/打開終端的插件(原子末端、末端加等)

  • 你應該/bin/bash在哪裡使用外殼解釋器路徑為必填項。
  • 使用/usr/bin/gnome-terminalor /usr/bin/x-terminal-emulatorwhere 的路徑終端模擬器應用程式是必須的。

希望能幫助你。

答案2

我最近遇到了同樣的問題。我建議您的最簡單的解決方案是在 Visual Studio Code 的 settings.json 檔案中新增此行。最新版本的 Code 可讓您透過 GUI 編輯 settings.json。將其切換到 JSON 視圖模式。您可以在右上角找到該切換按鈕。

"terminal.integrated.shell.linux": "bash"

而且,你已經完成了。運行終端。 Bash 應該會增強。

答案3

  • 開啟首選項 > 設定或直接使用Ctrl+,
  • 搜尋Terminal › Integrated › Shell: Linux
  • 點選Edit in settings.json
  • 最後添加此行"terminal.integrated.shell.linux" : "/bin/bash"並重新啟動您的應用程式。

相關內容