randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.37k stars 83 forks source link

Terminus (with bash) seemingly doesn't load my ~/.profile #380

Closed sosloow closed 1 year ago

sosloow commented 1 year ago

Hello, I'm using Ubuntu 22.04. After one of the updates terminus stopped loading ~/.profile and subsequently ~/.bashrc with my env variables and configs. What can I do to debug and fix it?

randy3k commented 1 year ago

You would need to run a login shell if we want to load ~/.profile.

sosloow commented 1 year ago

I thought terminus runs a login shell by default? If it doesn't, how can I make sure, that terminus runs it?

Ok, as I understand, it should be enabled just by specifying -l after bash in cmd.

And this is exactly how it is in the default config, that I use

        {
            "name": "Bash",
            "cmd": ["bash", "-i", "-l"],
            "env": {

            },
            "enable": true,
            "platforms": ["linux", "osx"]
        }

What might be the problem with it?

randy3k commented 1 year ago

Oh, you are right. I am not sure what has happened. I believe bash login shell reads .bash_profile first, right?

sosloow commented 1 year ago

I think, on my system it reads .profile first and then sources .bashrc from there.

But I just tried copying .bashrc to .bash_profile, and terminus loaded all of my configs from there.

I always thought, .bash_profile is used on osx, and on ubuntu it's should be .bashrc

randy3k commented 1 year ago

.bash_profile is different from .bashrc. bash_profile is for login shell and bashrc is for interactive shell. Note that login shell could be either interactive or non-interactive.

You just need to put

if [[ -f ~/.profile ]]; then
    source ~/.profile
fi
if [[ -f ~/.bashrc ]]; then
   source ~/.bashrc
fi

in .bash_profile.

It is I believe the recommended way to make sure the files are always sourced correctly.

sosloow commented 1 year ago

Ok, makes sense, thanks.