VSCode集成的终端无法加载.bashrc或.bash_profile文件。
VSCode集成的终端无法加载.bashrc或.bash_profile文件。
我需要处理shell配置的以下文件:
#~/.bash_profile if [ -f ~/.bashrc ]; then source ~/.bashrc fi
和
#~/.bashrc ... configure shell
如果我使用code
从命令行打开VSCode,每当我添加一个新的终端实例时,我的.bashrc
都会被加载。
但是,如果我通过其图标打开VSCode,则仅加载我的.profile
。
我如何确保我的.bashrc
被加载?
我已尝试各种terminal.integrated.shellArgs.osx
设置,但都没有成功。
admin 更改状态以发布 2023年5月21日
只需将 shell 参数添加到 VsCode 的 settings.json
文件中。
settings.json
文件的路径如下:
Windows: C:\Users\\AppData\Roaming\Code\User\settings.json` Linux: $HOME/.config/Code/User/settings.json Mac: $HOME/Library/Application\ Support/Code/User/settings.json
添加以下之一:
"terminal.integrated.shellArgs.windows": ["-l"], "terminal.integrated.shellArgs.linux": ["-l"], "terminal.integrated.shellArgs.osx": ["-l"],
这将使用登录参数启动您选择的 shell。因此,将执行任何设置的用户配置文件。