Run bash commands or script when opening new terminal, specific to WS project

Is there a way to run a bash command/script whenever opening a new terminal in WS?  Similar to placing a script in one's `.bash_profile` or `.zshrc`, but specifically to be run only for, and be configurable, on a project by project basis?

For example,

Right now, I have two project windows open in WS.  One is in my ~/dev/foo folder and the other is in ~/dev/bar.  I have a `cd ~/dev/foo` in my `.zshrc` since that's the project I work on the most.  I'd like to have it so the "bar" project, when I open a terminal, instead opens and runs `cd ~/dev/bar`.

Is any of this possible somehow?

2
4 comments

Startup scripts are loaded from `.zshrc`... There is no way to set them per-project.

-5

Elena Pogorelova
Total disagreement.
There is always a situation where you need to have custom shell / bash settings per project.

5

Yeah.. that's a bit preposterous to just make the blanket assertion that "there's no way"

0

Will be nice to do this per project. In my mind it will be run after the OS runs its scripts. Will be like pasting the commands in after the terminal has opened and will be nice to see the output of those commands

0

Please sign in to leave a comment.