.bashrc不是来自Intellij IDEA的终端

Ale*_*hel 11 bash intellij-idea

.bashrc在我的Intellij IDEA终端上使用了一些别名.为什么.bashrc不采购?

小智 16

IntelliJ 也有同样的问题。\n通过设置值\xc2\xa0 /bin/bash --login\xc2\xa0in解决了这个问题setting->Tools->Terminal->Shell path

\n

/bin/bash --login\xc2\xa0 强制 bash 读取~/.bash_profile.

\n

https://intellij-support.jetbrains.com/hc/en-us/community/posts/205437150-Terminal-not-source-bash-profile?page=1#community_comment_360000167679

\n


Kyl*_*and 10

.bashrc仅在Bash以“交互”模式运行时才加载。由于某些原因,IntilliJ默认以非交互模式运行Bash,但这很容易更改。打开IntelliJ设置窗口,然后打开“工具->终端”,并添加-i到Shell路径。

(请注意,在此屏幕截图中,我还更改了默认外壳程序,因为我在Mac上,这使得更新变得困难/bin/bash。除非您安装了其他版本的Bash,否则请勿盲目复制此更改!)

在此处输入图片说明

  • 因此,如果您的“终端 > Shell 路径”设置调用“bash -i”(交互式),它将在打开新选项卡时运行“~/.bashrc”;如果它调用 `bash` (非交互式),它将运行 `~/.bash_profile`。*在 macOS Catalina 上针对 WebStorm 2020.3.3 进行检查。* (3认同)

Sar*_*ran 8

对我来说,改变线路

Exec="/opt/idea-IU-183.4284.148/bin/idea.sh" %f
Run Code Online (Sandbox Code Playgroud)

Exec=bash -ic "/opt/idea-IU-183.4284.148/bin/idea.sh" %f 
Run Code Online (Sandbox Code Playgroud)

工作。我们利用交互式 shell 加载的 hack .bashrc:)


mas*_*ush 8

在Mac OSX卡塔利娜,"/bin/bash"~/.zprofile为我工作:

在此处输入图片说明

更新:

Apple 已将默认 shell 更改为zsh.因此您必须重命名配置文件。.bashrc现在是.zshrc.bash_profile现在.zprofile


SLe*_*ort 7

在您的主目录中,添加这些行.profile(如果文件不存在,则创建该文件),以便获取.bashrc:

if [ "$SHELL" = "/bin/bash" ]; then
    . ~/.bashrc
fi   
Run Code Online (Sandbox Code Playgroud)