VSCode 集成终端不加载 .bashrc 或 .bash_profile [英] VSCode Integrated Terminal Doesn't Load .bashrc or .bash_profile
问题描述
我有以下文件来处理 shell 配置:
I have the following files to handle shell configuration:
#~/.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
和
#~/.bashrc
... configure shell
如果我使用 code
从命令行打开 VSCode,我的 .bashrc
会在我添加集成 shell 的新实例时加载.
If I open VSCode from the command line using code
, my .bashrc
is loaded whenever I add a new instance of the integrated shell.
但是,如果我通过其图标打开 VSCode,只会加载我的 .profile
.
However if I open VSCode via its icon, only my .profile
is loaded.
如何确保我的 .bashrc
被加载?
How can I ensure my .bashrc
is loaded instead?
我已经尝试了 terminal.integrated.shellArgs.osx
设置的各种设置,但没有任何运气.
I've tried various settings for the terminal.integrated.shellArgs.osx
setting without any luck.
推荐答案
只需将 shell 参数添加到设置中即可.在 Windows 上使用 git bash 进行了测试,但在 Osx 和 Linux 上应该可以正常工作.
Simply add shell args to the settings. Tested on Windows with git bash but it should work same on Osx and Linux.
在 C:Users
或您的 Windows 设置所在的位置:添加以下内容之一:
In C:Users<username>AppDataRoamingCodeUsersettings.json
or where your windows setting is:
Add one of the following:
"terminal.integrated.shellArgs.windows": ["-l"],
"terminal.integrated.shellArgs.linux": ["-l"],
"terminal.integrated.shellArgs.osx": ["-l"],
就在terminal.integrated.shell.
这将使用 login 参数启动 bash.
This will launch bash with the login argument.
这篇关于VSCode 集成终端不加载 .bashrc 或 .bash_profile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!