Skip to content

Comment on How to add a directory to your PATH

Comments

.bashrc gets run every time a shell starts

I'm not sure I'd stick a path setting in .bashrc - just because it would make it very difficult to ever override that PATH setting elsewhere.

You might want that but it might also mess up some other program's attempt to set the PATH and then e.g. run a shell command.

I usually use .bash_profile or .profile more for this sort of thing and then I have to tell my terminal program to run bash as a login shell and that gives me what I mostly expect.

So e.g. when I get an interactive shell from vim, for example, or an IDE it will execute .bashrc which can blow away settings I want for building.

.bashrc gets run every time a shell starts

Probably because it's sourced from your distro provided /etc/profile. Bash will only source .bashrc on its own in some cases.

It seems to be for interactive shells. So I probably hit a problem while shelling out from my editor but potentially any IDE that has a command prompt will have trouble if it's trying to set environment variables.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.